Last active
March 15, 2024 16:33
-
-
Save snandam/4776360c58ceec6b7754c0e6ccc3a8f5 to your computer and use it in GitHub Desktop.
Identify AWS regions a particular instance type is available
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################### | |
# IAM user need to have "ec2:DescribeInstanceTypeOfferings" permission to be able to run this | |
#################### | |
#!/bin/bash | |
instance_type=g5g.2xlarge | |
echo "Region $instance_type Availability" | |
echo "------ -------------------------" | |
aws ec2 describe-regions --query "Regions[].RegionName" --output text | tr '\t' '\n' | while read region; do | |
availability=$(aws ec2 describe-instance-type-offerings --region "$region" --location-type region --filters Name=instance-type,Values=$instance_type --query "InstanceTypeOfferings[]" --output text) | |
if [[ -z $availability ]]; then | |
echo "$region False" | |
else | |
echo "$region True" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment