Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save florin-andrei-curbside/3f4efdd98f454cbe1617f1152ff06c13 to your computer and use it in GitHub Desktop.
Save florin-andrei-curbside/3f4efdd98f454cbe1617f1152ff06c13 to your computer and use it in GitHub Desktop.
list all API instances in all regions
for reg in `aws ec2 describe-regions --query 'Regions[].[RegionName]' --output=text`; do
aws --region=${reg} ec2 describe-instances --filters "Name=tag:Name, Values=api-*" \
--query 'Reservations[].Instances[].[PrivateIpAddress, Tags[?Key==`Name`] | [0].Value]' \
--output=text | grep -v ^None
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment