Skip to content

Instantly share code, notes, and snippets.

@HieronyM
Created September 22, 2020 03:09
Show Gist options
  • Select an option

  • Save HieronyM/9e8a4f84d09d7ffdec7ffd08c0699d42 to your computer and use it in GitHub Desktop.

Select an option

Save HieronyM/9e8a4f84d09d7ffdec7ffd08c0699d42 to your computer and use it in GitHub Desktop.
List ec2 instances information based on specific filter, and output them into .csv file
aws --profile sdsdevelmanager ec2 describe-instances --filters "Name=tag:Domain, Values=PRODUCTION-GOLD"\
--query 'Reservations[*].Instances[*].[ [Tags[?Key==`Name`].Value] [0][0], [Tags[?Key==`Domain`].Value] [0][0], InstanceId, PublicIpAddress, PrivateIpAddress, InstanceType, Placement.AvailabilityZone ]'\
--output text > instances.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment