Matching EC2 Availability Zones Across AWS Accounts


Summary: EC2 availability zone names in different accounts do not match to the same underlying physical infrastructure. This article explains a trick which can be used to figure out how to match availability zone names between different accounts.


As of the updating of this article (2014-11-03) Amazon EC2 (Elastic Compute Cloud) has over thirty different availability zones in eleven regions. A region can be thought of as a specific area of the world. An availability zone can be thought of roughly as a data center, defined such that no single failure scenario should affect two availability zones.

The current regions are:

  • us-east-1
  • us-west-1
  • us-west-2
  • us-gov-west-1
  • eu-central-1
  • eu-west-1
  • ap-northeast-1
  • ap-southeast-1
  • ap-southeast-2
  • sa-east-1
  • cn-north-1

The availability zones in those regions are given the region name plus simple letters appended. For example:

  • us-east-1a
  • us-east-1b
  • us-east-1c
  • us-east-1d
  • us-east-1e


  • eu-west-1a
  • eu-west-1b

When you start EC2 instances, you can specify an availability zone or let Amazon pick one for you. You always have a default region which can be overridden when starting instances.


In order to prevent an overloading of a single availability zone when everybody tries to run their instances in us-east-1a, Amazon has added a layer of indirection so that each account’s availability zones can map to different physical data center equivalents.

For example, zone us-east-1a in your account might be the same as zone us-east-1c in my account and us-east-1d in a third person’s account.

In fact, given the way that Amazon has set this up, I would not be surprised if Amazon may not occasionally reassign availability zone names which you are not currently using. For example, Amazon added the fourth availability zone in the us-east-1 region, but I suspect this might not be us-east-1d in all accounts (especially new ones).


On occasion, users sometimes want to know if instances in different accounts are running in the same availability zone. Or, users might want to know which availability zone is the one with which people are currently experiencing a particular problem.

You’ll often see users say that there is a problem in zone us-east-1a but this isn’t very helpful for other users because (as described above) that name only has significance within the original user’s account.

What would be helpful is a unique identifier which maps to the underlying physical infrastructure (e.g., data center) and can be mapped to the different availability zone names in each account.

I believe that Amazon may have inadvertently let slip a way to obtain this in the current implementation of the reserved instance offering ids. In my experiments so far, these seem to be tied to something outside of the account’s availability zones and, though the ids are the same, they are mapped to different availability zone names for different accounts.

To demonstrate this I’ve arbitrarily chosen the reserved instance offerings for m3.medium, Linux/UNIX, Heavy Utilization, one year, non-Marketplace, non-VPC.

To list the mappings for a single account, you can use a command like:

aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]' |
  while read region; do
    aws ec2 describe-reserved-instances-offerings --region $region --output text --query 'ReservedInstancesOfferings[*].[AvailabilityZone,ReservedInstancesOfferingId,InstanceType,OfferingType,ProductDescription,InstanceTenancy,Marketplace,Duration]'| 
      egrep 'm3\.medium.Heavy Utilization.Linux/UNIX.default.False.31536000' | 
      cut -f1,2
done | sort

The describe-reserved-instances-offerings API call can be very slow, so wait patiently for the output.


Here are the mappings for one of my accounts (let’s call it “Blue”):

ap-northeast-1b 6126282e-74c0-42db-a3c0-cfb4535203df
ap-northeast-1c f72822dd-b4ac-431e-a8a7-74eb6cb3712d
ap-southeast-1a ca82f875-3397-46e2-915e-1f0149617db3
ap-southeast-1b 528964f4-71a0-4209-8be7-81efc91e0742
ap-southeast-2a 97875095-d596-4535-a355-3edd28a6c404
ap-southeast-2b 31a8bf89-1ec8-4bfd-b8d9-f044d4ce37bb
eu-central-1a   223aa78f-7609-4d55-adf4-26523b76497c
eu-central-1b   0f756f35-6d7d-40e8-99d3-da56ad5e79ca
eu-west-1a  3a02219b-7eca-42f1-967b-513dc8faea80
eu-west-1b  b90c4fcf-4b9a-404b-adb0-378b0bb1d15b
eu-west-1c  d538b1e9-12c4-4b65-8ad9-fd138fa0ffb7
sa-east-1a  ada8467a-6227-4a7c-a08c-0bf7fa1a9b78
sa-east-1b  bfe7cebc-d6ce-4186-b405-16c798408f8d
us-east-1a  f0e32143-5358-4e0c-a809-b7ebb6f76f94
us-east-1c  451c0ebc-e07f-4ff1-a8c5-936965408bee
us-east-1d  afd143f6-2f95-4db4-86ac-b1210bef0254
us-east-1e  a19441e7-7e25-4d4c-bce1-71a7bced2c9a
us-west-1a  0c31ec4b-6dbf-4775-9736-137e6cae5e35
us-west-1c  b5677909-0292-4d17-b394-3286a9a10119
us-west-2a  3a32d7f4-a14a-4d25-9617-b7e2f98c3986
us-west-2b  882971b6-0f4e-454c-b72f-9b3177090aba
us-west-2c  a7ecdbc4-2441-4375-84c7-37400deccaed

Here are the mappings for a different account (let’s call it “Red”):

ap-northeast-1b 6126282e-74c0-42db-a3c0-cfb4535203df
ap-northeast-1c f72822dd-b4ac-431e-a8a7-74eb6cb3712d
ap-southeast-1a 528964f4-71a0-4209-8be7-81efc91e0742
ap-southeast-1b ca82f875-3397-46e2-915e-1f0149617db3
ap-southeast-2a 31a8bf89-1ec8-4bfd-b8d9-f044d4ce37bb
ap-southeast-2b 97875095-d596-4535-a355-3edd28a6c404
eu-central-1a   223aa78f-7609-4d55-adf4-26523b76497c
eu-central-1b   0f756f35-6d7d-40e8-99d3-da56ad5e79ca
eu-west-1a  b90c4fcf-4b9a-404b-adb0-378b0bb1d15b
eu-west-1b  3a02219b-7eca-42f1-967b-513dc8faea80
eu-west-1c  d538b1e9-12c4-4b65-8ad9-fd138fa0ffb7
sa-east-1a  bfe7cebc-d6ce-4186-b405-16c798408f8d
sa-east-1b  ada8467a-6227-4a7c-a08c-0bf7fa1a9b78
us-east-1a  451c0ebc-e07f-4ff1-a8c5-936965408bee
us-east-1b  f0e32143-5358-4e0c-a809-b7ebb6f76f94
us-east-1d  afd143f6-2f95-4db4-86ac-b1210bef0254
us-east-1e  a19441e7-7e25-4d4c-bce1-71a7bced2c9a
us-west-1b  0c31ec4b-6dbf-4775-9736-137e6cae5e35
us-west-1c  b5677909-0292-4d17-b394-3286a9a10119
us-west-2a  3a32d7f4-a14a-4d25-9617-b7e2f98c3986
us-west-2b  882971b6-0f4e-454c-b72f-9b3177090aba
us-west-2c  a7ecdbc4-2441-4375-84c7-37400deccaed

From this, I theorize that availability zone us-east-1a in account Blue is the same as availability zone us-east-1b in account Red, but availability zones us-east-1d happen to be the same in both accounts.


Please note that this approach is not a documented feature of Amazon EC2. I may be misinterpreting what I am seeing and the mappings may be completely random for different accounts.

Amazon could at any time restructure how these values work so that the described offering ids cannot be used between accounts or do not map to any common infrastructure.

Use at your own risk and please post a comment if you find out any further data to support or disprove this theory.

Not all accounts have access to all regions or availability zones in those regions.

Not all accounts have access to reserved instances in the availability zones they have access to.

The Reserved Instance offering ids change from time to time over the years for unknown and unpublished reasons.


[Update 2011-04-25: Tweaked command line to exclude more instance types Amazon has added. Updated info for current ids in current regions/zones.]

[Update 2011-12-23: Tweaked command line to exclude more instance types Amazon has added. Updated info for current ids in current regions/zones.]

[Update 2014-11-03: Updated to use new aws-cli command syntax]


Awesome - thanks!

This can help eliminate cross-availability-zone networking charges when I copy data from my Testing account to/from my Production account. In order to restrict access to the Production deployment I have two separate AWS accounts, Testing and Production. The AZs in these accounts do not match, and I sometimes end up being charged for transferring data between (instances belonging to) the two accounts. Using your tip I can figure out where to deploy my Testing instances to save $$ transferring data between instances belonging to the different accounts.

As of Dec. 20, 2012 it looks like Amazon has changed their zones mapping again. Now for each zone they have multiple codes. Below are few output lines from one of my EC2 accounts:

ap-northeast-1a 3a98bf7d-8adc-4dfe-9bd6-b16a735c0894
ap-northeast-1a 4b2293b4-ed86-4e9c-a41d-b9aa6ab6d143
ap-northeast-1a d586503b-1ff7-4466-8593-34b02b42d768
ap-northeast-1b 4b2293b4-8b7a-4aec-9636-cc4aad7e3514
ap-northeast-1b ceb6a579-9e28-422a-ac6b-d200348f1ea1
ap-northeast-1b ceb6a579-a3ba-4488-ae42-59ca92a3d26f


Thanks. I have updated the code above to only look for "Medium Utilization" records (the previous default).

Another approach to the same problem (though definitely a more complex approach) would be to use the spot instance pricing history. The history can be used as a signature to match azs across accounts -- histories rarely match between azs in the same region with even the 1 day timeframe (exception being us-west-2/Oregon).

Also worth noting -- this is a guess -- I haven't tried it in practice yet. Maybe I'll find that spot rates differ between accounts in the same datacenter/ configuration.

Do you mind telling users who are unfamiliar with commands such as "ec2-describe-regions" where one can obtain those commands. I've tried running them on my ec2 instance to no avail.


You can install these commands on Ubuntu using:

sudo apt-get install ec2-api-tools

You'll also need to set up the AWS credentials and some environment variables as described here:

Leave a comment

Ubuntu AMIs

Ubuntu AMIs for EC2:

More Entries

When Are Your SSL Certificates Expiring on AWS?
If you uploaded SSL certificates to Amazon Web Services for ELB (Elastic Load Balancing) or CloudFront (CDN), then you will want to keep an eye on the expiration dates and…
Throw Away The Password To Your AWS Account
reduce the risk of losing control of your AWS account by not knowing the root account password As Amazon states, one of the best practices for using AWS is Don’t…
AWS Community Heroes Program
Amazon Web Services recently announced an AWS Community Heroes Program where they are starting to recognize publicly some of the many individuals around the world who contribute in so many…
EBS-SSD Boot AMIs For Ubuntu On Amazon EC2
With Amazon’s announcement that SSD is now available for EBS volumes, they have also declared this the recommended EBS volume type. The good folks at Canonical are now building Ubuntu…
EC2 create-image Does Not Fully "Stop" The Instance
The EC2 create-image API/command/console action is a convenient trigger to create an AMI from a running (or stopped) EBS boot instance. It takes a snapshot of the instance’s EBS volume(s)…
Finding the Region for an AWS Resource ID
use concurrent AWS command line requests to search the world for your instance, image, volume, snapshot, … Background Amazon EC2 and many other AWS services are divided up into various…
Changing The Default "ubuntu" Username On New EC2 Instances
configure your own ssh username in user-data The official Ubuntu AMIs create a default user with the username ubuntu which is used for the initial ssh access, i.e.: ssh ubuntu@<HOST>…
Default ssh Usernames For Connecting To EC2 Instances
Each AMI publisher on EC2 decides what user (or users) should have ssh access enabled by default and what ssh credentials should allow you to gain access as that user.…
New c3.* Instance Types on Amazon EC2 - Nice!
Worth switching. Amazon shared that the new c3.* instance types have been in high demand on EC2 since they were released. I finally had a minute to take a look…
Query EC2 Account Limits with AWS API
Here’s a useful tip mentioned in one of the sessions at AWS re:Invent this year. There is a little known API call that lets you query some of the EC2…
Using aws-cli --query Option To Simplify Output
My favorite session at AWS re:Invent was James Saryerwinnie’s clear, concise, and informative tour of the aws-cli (command line interface), which according to GitHub logs he is enhancing like crazy.…
Reset S3 Object Timestamp for Bucket Lifecycle Expiration
use aws-cli to extend expiration and restart the delete or archive countdown on objects in an S3 bucket Background S3 buckets allow you to specify lifecycle rules that tell AWS…
Installing aws-cli, the New AWS Command Line Tool
consistent control over more AWS services with aws-cli, a single, powerful command line tool from Amazon Readers of this tech blog know that I am a fan of the power…
Using An AWS CloudFormation Stack To Allow "-" Instead Of "+" In Gmail Email Addresses
Launch a CloudFormation template to set up a stack of AWS resources to fill a simple need: Supporting Gmail addresses with “-” instead of “+” separating the user name from…
New Options In ec2-expire-snapshots v0.11
The ec2-expire-snapshots program can be used to expire EBS snapshots in Amazon EC2 on a regular schedule that you define. It can be used as a companion to ec2-consistent-snapshot or…
Replacing a CloudFront Distribution to "Invalidate" All Objects
I was chatting with Kevin Boyd (aka Beryllium) on the ##aws Freenode IRC channel about the challenge of invalidating a large number of CloudFront objects (35,000) due to a problem…
Email Alerts for AWS Billing Alarms
using CloudWatch and SNS to send yourself email messages when AWS costs accrue past limits you define The Amazon documentation describes how to use the AWS console to monitor your…
Cost of Transitioning S3 Objects to Glacier
how I was surprised by a large AWS charge and how to calculate the break-even point Glacier Archival of S3 Objects Amazon recently introduced a fantastic new feature where S3…
Running Ubuntu on Amazon EC2 in Sydney, Australia
Amazon has announced a new AWS region in Sydney, Australia with the name ap-southeast-2. The official Ubuntu AMI lookup pages (1, 2) don’t seem to be showing the new location…
Save Money by Giving Away Unused Heavy Utilization Reserved Instances
You may be able to save on future EC2 expenses by selling an unused Reserved Instance for less than its true value or even $0.01, provided it is in the…
Installing AWS Command Line Tools from Amazon Downloads
This article describes how to install the old generation of AWS command line tools. For the most part, these have been replaced with the new AWS cli that is…
Convert Running EC2 Instance to EBS-Optimized Instance with Provisioned IOPS EBS Volumes
Amazon just announced two related features for getting super-fast, consistent performance with EBS volumes: (1) Provisioned IOPS EBS volumes, and (2) EBS-Optimized Instances. Starting new instances and EBS volumes with…
Which EC2 Availability Zone is Affected by an Outage?
Did you know that Amazon includes status messages about the health of availability zones in the output of the ec2-describe-availability-zones command, the associated API call, and the AWS console? Right…
Installing AWS Command Line Tools Using Ubuntu Packages
See also: Installing AWS Command Line Tools from Amazon Downloads Here are the steps for installing the AWS command line tools that are currently available as Ubuntu packages. These include:…
Ubuntu Developer Summit, May 2012 (Oakland)
I will be attending the Ubuntu Developer Summit (UDS) next week in Oakland, CA. ┬áThis event brings people from around the world together in one place every six months to…
Uploading Known ssh Host Key in EC2 user-data Script
The ssh protocol uses two different keys to keep you secure: The user ssh key is the one we normally think of. This authenticates us to the remote host, proving…
Seeding Torrents with Amazon S3 and s3cmd on Ubuntu
Amazon Web Services is such a huge, complex service with so many products and features that sometimes very simple but powerful features fall through the cracks when you’re reading the…
There are a number of CloudCamp events coming up in cities around the world. These are free events, organized around the various concepts, technologies, and services that fall under the…
Use the Same Architecture (64-bit) on All EC2 Instance Types
A few hours ago, Amazon AWS announced that all EC2 instance types can now run 64-bit AMIs. Though t1.micro, m1.small, and c1.medium will continue to also support 32-bit AMIs, it…
ec2-consistent-snapshot on GitHub and v0.43 Released
The source for ec2-conssitent-snapshot has historically been available here: ec2-consistent-snapshot on using Bazaar For your convenience, it is now also available here: ec2-consistent-snapshot on GitHub using Git You are…