See what regions have instances, and find out how to generate your own list with a python script.
The script below will find all the regions you have access to and display which ones have Inferentia2 or Trainium instances types enabled. Watch for announcements from AWS for availability in new regions, check the sample output below, or run the script yourself for a customized list! (some regions require opt-in. If you have not opted into those regions, you will not see them in your results).
This script requires the AWS CLI to be installed and configured.
This only shows whether the instance type is available in that region, it does NOT show that there are available instances for deployment this moment.
Example output is below.
Supported Regions as of August 25, 2024
================
-
ap-south-1: Asia Pacific (Mumbai)
-
eu-north-1: Europe (Stockholm)
-
eu-west-3: Europe (Paris)
-
eu-west-2: Europe (London)
-
eu-west-1: Europe (Ireland)
-
ap-northeast-1: Asia Pacific (Tokyo)
-
sa-east-1: South America (Sao Paulo)
-
ap-southeast-1: Asia Pacific (Singapore)
-
ap-southeast-2: Asia Pacific (Sydney)
-
eu-central-1: Europe (Frankfurt)
-
us-east-1: US East (N. Virginia)
- inf2.48xlarge
- trn1.32xlarge
-
us-east-2: US East (Ohio)
- inf2.48xlarge
- trn1.32xlarge
-
us-west-2: US West (Oregon)
- inf2.48xlarge
- trn1.32xlarge
The script to generate the markup displayed above:
import boto3
from datetime import datetime
ec2 = boto3.client('ec2')
regions = [region['RegionName'] for region in ec2.describe_regions()['Regions']]
#Edit this line to change the instance types displayed
instance_types = ['trn1.32xlarge', 'inf2.48xlarge']
supported_regions = {}
for region in regions:
ec2_region = boto3.client('ec2', region_name=region)
response = ec2_region.describe_instance_type_offerings(
#LocationType='availability-zone',
Filters=[
{'Name': 'instance-type', 'Values': instance_types},
]
)
if response['InstanceTypeOfferings']:
supported_regions[region] = [offer['InstanceType'] for offer in response['InstanceTypeOfferings']]
print('# Supported Regions as of',datetime.now().strftime('%B %d, %Y'))
print('================')
client = boto3.client('ssm')
for region, instance_types in supported_regions.items():
try:
response = client.get_parameter(Name=f'/aws/service/global-infrastructure/regions/{region}/longName')
region_long_name = response['Parameter']['Value']
except (client.exceptions.ParameterNotFound, KeyError):
region_long_name = region
print(f'* {region}: {region_long_name}')
for instance_type in instance_types:
print(f' - {instance_type}')
print("\n")
If you would like the detail down to an availability zone level:
import boto3
from datetime import datetime
from collections import defaultdict
ec2 = boto3.client('ec2')
regions = [region['RegionName'] for region in ec2.describe_regions()['Regions']]
#Edit the line below to change the instance types displayed
instance_types = ['trn1.32xlarge', 'inf2.48xlarge']
supported_regions = defaultdict(list)
for region in regions:
ec2_region = boto3.client('ec2', region_name=region)
response = ec2_region.describe_instance_type_offerings(
LocationType='availability-zone',
Filters=[
{'Name': 'instance-type', 'Values': instance_types},
]
)
print(response)
if response['InstanceTypeOfferings']:
sorted_offerings = sorted(response['InstanceTypeOfferings'], key=lambda offer: offer['Location'])
for offer in sorted_offerings:
supported_regions[offer['Location']].append(offer['InstanceType'])
#supported_regions[Location] = [offer['InstanceType'] for offer in response['InstanceTypeOfferings']]
print('# Supported Availability Zones as of',datetime.now().strftime('%B %d, %Y'))
print('================')
for Location, instance_types in supported_regions.items():
print(f'* {Location}: {", ".join(instance_types)}')