I have 2 API calls, the second uses AMI-ID from the first
aws ec2 describe-instances \
--query "Reservations[*].{ \
OWNERID:OwnerId, \
IP:Instances[0].PublicIpAddress, \
ImageID:Instances[0].ImageId, \
AZ:Instances[0].Placement.AvailabilityZone, \
STATE:Instances[0].State.Name, \
KEY:Instances[0].KeyName, \
VPC:Instances[0].VpcId, \
ID:Instances[0].InstanceId, \
INSTANCETYPE:Instances[0].InstanceType \
}" --output text
and
aws ec2 describe-images \
--image-ids ami-xxx\
--query "Images[*].{ImageName:Name, AWSDescription:Description}" \
--output text
I am trying to have individual instances with the image name and description from their respective images on the same lines, for a single table with all the columns from both calls.
Is it possible to do it in the same command (i strongly doubt it)? If not, how would I go about in a shell script? Do I have to grep the AMI-ID from the first call and use it? But that first call returns a whole table, how can i then "append" the extra columns next to the first ones and not under?