Created
September 25, 2018 12:17
-
-
Save jeffbrl/4dfe2e809a40864e807173b2063d141e to your computer and use it in GitHub Desktop.
List AWS 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
#!/bin/sh | |
# From fitblip at https://github.com/aws/aws-cli/issues/1777#issuecomment-284262414 | |
for region in `aws ec2 describe-regions --output text | cut -f3` | |
do | |
echo -e "\nListing Instances in region:'$region'..." | |
aws ec2 describe-instances --region $region | jq '.Reservations[] | ( .Instances[] | {state: .State.Name, name: .KeyName, type: .InstanceType, key: .KeyName})' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment