AWS Regions API

AWS drives everything via API. Why don't they have a simple list of regions and endpoints?

Image of map

Amazon Web Services (AWS) drives everything via API. You can start and stop servers, create new databases, and even ingest data from satellites. Frankly, I find it magical. But one thing I couldn't find, even after Googling and asking in various Slacks, was any way to get a current, up to date list of AWS regions in an API format.

Why#

Why do you care about the list of regions? Each region is an island, and for the most part services are self contained within regions (a few like Route53 and IAM are not).

Given this, you might want to:

  • scan all the regions for rogue (or, more likely, forgotten) EC2 instances.
  • compare AWS with other cloud providers in terms of geographic availability.
  • create an application in every region (including new ones).
  • have a celebration when a new region comes online.

OK, probably not that last one.

Options#

The options that I found to get the new regions via API:

  • use EC2 describe regions API. This assumes that any region will have the EC2 service. Probably a pretty safe bet.
  • use the boto endpoints.json file. You then depend on the Boto maintainers, but they are pretty good about keeping up to date with the standard regions, though they don't appear to have govcloud or the other opt-in regions.
  • use the data behind this infrastructure map. Looking at the source shows this JavaScript. This is a bit fragile for me, but it's a beautiful map.

An API endpoint#

Luckily, Transposit supports API endpoints. I exposed the output of the EC2 describe regions call via an endpoint. Now you can enjoy the glory of all AWS regions exposed as a JSON array.

Note that this is limited to the regions to which my AWS accounts has access (because I am pulling the data from the EC2 describe regions call using my credentials). I have access to all the standard regions, but not the special ones like GovCloud or the Chinese regions.

If, on the other hand you wanted to have access to all the regions to which you had access, you'd need to provide your own credentials. The easiest way to do that is to fork the app (you can do so here) and provide your own AWS keys.

Get insights from Transposit in your inbox monthly.

Subscribe

< Back to the blog