After completing my recent post, “What Is The Size And Scope Of AWS Anyway?” I stumbled across another interesting metric to compare one region to another across AWS – EC2 instance types offered per region.
While attempting to launch a test EC2 instance into a local zone I was getting a rather unuseful error message in the AWS Console that my launch failed. Fairly quickly I (correctly) determined the failure was due to the instance type I selected not being available in that local zone, which in this case was us-east-1-dfw-1a in the DFW area.
After trying a few different EC2 instance types, all of which failed, I started to search the web for a solution. This lead me to a particularly useful one which is to enumerate a list of available instace types in either a particular region or local zone by making an API call to describe-instance-type-offerings. Since I regularly use the AWS CLI I used the following command to pull a list of availalble instance types in this particular local zone. For reference the command I used was:
aws ec2 describe-instance-type-offerings –region us-east-1 –location-type availability-zone –filters Name=location,Values=us-east-1-dfw-1a –output text
Taking this a step further I ran a shortened version of this call across most regions around the globe where AWS operates. Sans the two US GovCloud and China regions as I don’t have accounts in these particular regions. I simply shortened the command listing only a particular region in which I was interested, output it as text and counted the number of returned lines. Since I’m using PowerShell to run these commands I used, | Measure-Object –Line, to count the number lines returned from the call to each region. Example command:
aws ec2 describe-instance-type-offerings –region us-east-1 –output text | Measure-Object –Line
These results are not absolute, meaning they don’t necessarily indicate the overall size of a particular region. Namely because newer regions naturally will have fewer instance types for at least a couple of reasons. First, older regions still offer some of the first type of EC2 instances, m1, where newer regions do not. Also, newer regions do not support EC2 Classic which also supported certain instance types, particularly older instances. But, at the very least this is another interesting data point to give us a glimpse into the overall configuration of AWS across different regions.
It is also worth noting that as AWS rolls out new regions, local zones and such they no longer automatically enable those for all accounts by default. So in order to make various API calls to a particular region or even a local zone your account has to have those types of infrastructure enabled. For regions this is under Account Settings in the Console, and for local zones or WaveLength zones this can be done within the EC2 Console by selecting Zones.