Skip to content

Instantly share code, notes, and snippets.

@davidsayers
davidsayers / gist:b7e887390671f382a2f89e45b075ef4e
Created May 10, 2019 17:04
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