Skip to content

Instantly share code, notes, and snippets.

@amosshapira
Created November 30, 2015 06:06
Show Gist options
  • Select an option

  • Save amosshapira/780a6dc1ee67c7738c26 to your computer and use it in GitHub Desktop.

Select an option

Save amosshapira/780a6dc1ee67c7738c26 to your computer and use it in GitHub Desktop.
List all AWS regions and EC2 availability zones using AWS cli
#!/bin/bash
# Uses jq to extract data from JSON
aws ec2 describe-regions | \
jq -r '.Regions[] | .RegionName' | \
while read i
do
echo ==== $i ====
aws ec2 describe-availability-zones --region $i | \
jq -r '.AvailabilityZones[] | .ZoneName'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment