Created
September 7, 2018 19:53
-
-
Save sodejm/195bbaf1d13ca4fb1cd5541ba1b87032 to your computer and use it in GitHub Desktop.
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
# Author: sodejm | |
# Add to bash_profile as a quick way to list your US EC2 instances | |
# requires the aws-cli | |
# use: listusec2 | |
# List all EC2 Instances for US regions | |
function listec2(){ | |
for region in `aws ec2 describe-regions --filters "Name=endpoint,Values=*us*" --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