I am new here, please be gentle.
I am an IT Auditor (again be gentle) and I am trying to find ways to increase the efficiency of our audits for clients who use AWS. We have a test AWS environment and I am attempting to use the CLI to return a listing of Instances with their attached Security Groups.
Here is the command I am using:
aws ec2 describe-instances --query 'Reservations[].Instances[].{Instance_ID:InstanceId,SecurityGroup_Name:SecurityGroups[].GroupName,SecurityGroup_ID:SecurityGroups[].GroupId}' --output table
This gives me the information I want; however, the table format does something weird. The detail is not under the correct heading. Specifically, the SecurityGroup_Names attached to the first instance does not show up under the SecurityGroup_Name header; rather it shows up under the 2nd Instance ID header.
I'm assuming that I am fundamentally screwing something up and my results being accurate is just dumb luck. Any help is greatly appreciated. Thanks.
See pic (don't have enough rep points to show pic -you'll have to click):
https://s3.us-east-2.amazonaws.com/joey-linux-files/stuff/Inkedsg+query+table+output_LI.jpg
aws-cli/1.14.50 Python/3.6.4 Darwin/17.4.0 botocore/1.9.3- LHWizard