Skip to content

Instantly share code, notes, and snippets.

@gmirsky
Last active October 22, 2020 20:48
Show Gist options
  • Save gmirsky/01af31863cee6b45b541f18dc66fea82 to your computer and use it in GitHub Desktop.
Save gmirsky/01af31863cee6b45b541f18dc66fea82 to your computer and use it in GitHub Desktop.
Instance Report JSON
#!/usr/local/bin/bash
XXX=$(aws ec2 describe-instances \
--filters "Name=tag-key,Values=Name" \
--query 'Reservations[*].Instances[*].{Instance:InstanceId, Type:InstanceType, Platform:Platform, Volumes:BlockDeviceMappings[*].Ebs.VolumeId, NetworkInterfaces:PrivateIpAddress,AZ:Placement.AvailabilityZone, Name:Tags[?Key==`Name`]|[0].Value}' \
--output json)
echo "$XXX" > xxx.json
#!/usr/local/bin/bash
XXX=$(aws ec2 describe-instances \
--filters "Name=tag-key,Values=Name" \
--query 'Reservations[*].Instances[*].{Instance:[InstanceId, InstanceType, Platform,BlockDeviceMappings[*].Ebs.VolumeId],NetworkInterfaces:PrivateIpAddress,AZ:Placement.AvailabilityZone,Name:Tags[?Key==`Name`]|[0].Value}'
--output json)
echo "$XXX" > aws_test.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment