Skip to content

Instantly share code, notes, and snippets.

@rfletcher
Last active May 2, 2019 12:49
Show Gist options
  • Save rfletcher/7b5a5b1b6b5192676f75 to your computer and use it in GitHub Desktop.
Save rfletcher/7b5a5b1b6b5192676f75 to your computer and use it in GitHub Desktop.
List all AWS availability zones
#!/usr/bin/env bash
# List all AWS availability zones
#
# Depends on:
# - `aws`: https://aws.amazon.com/cli/ (installed and configured with credentials)
# - `jq`: https://stedolan.github.io/jq/
#
for REGION in $(
aws ec2 describe-regions | jq --raw-output '.Regions | map(.RegionName) | .[]' | sort
); do
aws ec2 describe-availability-zones --region "$REGION" |
jq --raw-output '.AvailabilityZones | map(.ZoneName) | .[]' |
sort
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment