Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidsayers/b7e887390671f382a2f89e45b075ef4e to your computer and use it in GitHub Desktop.
Save davidsayers/b7e887390671f382a2f89e45b075ef4e to your computer and use it in GitHub Desktop.
Generate a list of the AZs instance types can be launched in
#!/bin/bash
instance_types=$(curl -s https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json | jq -r '.products[].attributes["instanceType"]' | sort -u | grep '\.')
for instance in $instance_types; do
echo "$instance"
echo "----------"
aws ec2 describe-reserved-instances-offerings --filters 'Name=scope,Values=Availability Zone' --no-include-marketplace --instance-type "$instance" | jq -r '.ReservedInstancesOfferings[].AvailabilityZone' | sort | uniq
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment