Created
February 2, 2018 14:36
-
-
Save k5njm/56ac4fd0a294df8ff49b82771d08cf63 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
if [ -z "$1" ] | |
then | |
region_list=($(aws ec2 describe-regions --query 'Regions[].RegionName[]' --output text | gsed -e 'y/\t/\n/' | gsed '1!G;h;$!d')) | |
else | |
region_list=$1 | |
fi | |
clear | |
for i in "${region_list[@]}" | |
do | |
echo "Checking $i..." | |
# aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,LaunchTime,InstanceType,Tags[?Key==`Name`].Value,State.Name]' --output text --region $i | |
# echo "---------" | |
# echo "" | |
aws ec2 describe-instances --query 'Reservations[].Instances[].[{Name:Tags[?Key==`Name`] | [0].Value, ID:InstanceId, AZ:Placement.AvailabilityZone, Status:State.Name, Type: InstanceType, PublicIP:NetworkInterfaces[].Association[] | [0].PublicIp}]' --output table --region $i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment