Last active
January 30, 2020 09:42
-
-
Save mims92/f4b3b50da9e3d651920738ef606f4b47 to your computer and use it in GitHub Desktop.
AWS - Bash - List all EC2 instances
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/bash | |
#chmod +x /usr/bin/awsec2 | |
#Usage: awsec2 <profile-name> | |
aws ec2 describe-instances --profile $1 | jq -r '.[][].Instances[] | [ .InstanceId, (.Tags[]|select(.Key=="Name")|.Value), (.NetworkInterfaces[].PrivateIpAddresses[].PrivateIpAddress)] | select (.!=null) | @tsv' | column -s$'\t' -t' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment