Last active
December 1, 2016 23:49
-
-
Save florin-andrei-curbside/936092f95525199b0437eaaecbc77644 to your computer and use it in GitHub Desktop.
list all EC2 instances in all regions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
for reg in `aws ec2 describe-regions --query 'Regions[].[RegionName]' --output=text`; do | |
aws ec2 describe-instances --region ${reg} \ | |
--query 'Reservations[].Instances[].[Tags[?Key==`Name`] | [0].Value, InstanceId, Placement.AvailabilityZone, PrivateIpAddress, PublicIpAddress]' --output=text | |
done | |
# the output is Google Docs spreadsheet friendly. | |
# To make it human friendly, change it to --output=table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment