I am using aws-cli version 1.7.8 to get the --query
output to create one record that is derived from multiple lines.
In this case I am trying to get specific information from describe-instances
.
In the describe-instances
command, we get lines / sections that refer to RESERVATIONS
, INSTANCES
, and TAGS
.
I am able to simply run the new AWS CLI command to get the information from all three lines individually:
RESERVATION line:
aws ec2 describe-instances --instance-ids i-xxxxxxxx --query 'Reservations[*].ReservationId'
INSTANCE line:
aws ec2 describe-instances --instance-ids i-xxxxxxxx --query 'Reservations[*].[Instances[*].[InstanceId,ImageId]]'
TAG line:
aws ec2 describe-instances --instance-ids i-xxxxxxxx --query 'Reservations[].Instances[].[Tags[?Key==
Name]]'
I can run these 3 commands, and concatenate the results to form 1 record.
Does anyone know if there is a way I can run this as ONE (1) command, instead of 3 distinct commands?
I've tried PIPE and other forms of syntax, but I'm not able to find a good solution as of yet.
Can I get the equivalent output of these 3 commands from a single command?