* Latest update: December 31st, 2016. Article now includes data for the Canada and London regions.
Choosing an AWS region is the first decision you have to make when you set up your AWS components. You can’t do anything in the AWS Management Console, SDK or CLI without choosing a region. Most AWS customers choose one based on proximity to themselves or to their end users, which sounds like a sensible thing to do.
However, proximity alone is not enough. There are a lot of other factors to consider when choosing a region. Since my goal is to make applications grow on AWS, I’m always looking for factors that will make a difference. For example, AWS cost, feature selection, as well as the speed and resiliency of your AWS components.
So let’s get started…
You’re probably familiar with AWS Regions, but let me start with the basics, just in case. A region is a geographic area where AWS has data centers. Each region has 2 or more Availability Zones, which are independent data centers that are located close to each other. Availability Zones are used for redundancy and also for data replication. For services such as EC2, you can choose which AZ you want your instances to be launched into.
As of today, there are 14 public regions: N. Virginia, Ohio, Montreal, London, Ireland, Oregon, Singapore, Frankfurt, Seoul, Tokyo, Mumbai, Sao Paolo, N. California and Sydney. There are also 2 non-public regions: GovCloud and Beijing.
If most of your users access your application from within North America, then it typically makes sense to deploy your software in an AWS region located in the US or Canada. Sometimes, due to regulatory reasons you might be forced to choose a particular region - there are laws that mandate certain data to be stored in a particular country.
But there are a lot of other factors one has to consider when choosing a region. Here are a few…
Cost varies by region - choose the wrong one and you could end up paying a lot more
I’ve been using the AWS Price List API a lot lately. I use it to programmatically calculate the cost of every configuration I make. I wrote a script that sorts total cost by region and to my surprise there were substantial differences. When I say substantial, I mean more than a 170% difference in some cases. In the most common configurations, it’s not difficult to find a 30% or 75% price difference compared to the cheapest AWS region.
Take the following example:
1 ELB sends traffic to 10 t2.medium instances running Amazon Linux in the same Availability Zone. Each instance has 20GB of EBS SSD storage, and each instance receives 100GB/month from the ELB and sends 1TB/month back to the ELB - therefore the ELB processes 11TB/month.
*Prices are calculated using the AWS Price List API (as of December 31st, 2016)
Here are some highlights from these results:
- N. Virginia is typically the cheapest region - there might be exceptions, but so far I haven’t encountered one.
- It costs 65% more to deploy this infrastructure in Sao Paolo compared to N. Virginia. It’s worth noting that price differences have decreased since the first time I published this article, when Sao Paolo was 92% more expensive.
- Not all regions in the US cost the same. N. California would cost 23% more compared to N. Virginia or Oregon. Considering geography, Oregon could be a much better alternative for this deployment (it’s relatively close to California and cheaper).
- I would consider N. Virginia to be my first option, unless latency to my end users is unacceptable (more on that below). I would also have to think about data transfer costs in and out of that region, but based on computing costs alone N. Virginia is the cheapest alternative.
- I would avoid Sao Paolo, unless I absolutely had to deploy in that region due to really bad latency or regulation.
Regions have different latencies and data transfer speeds
Let’s say you discover that a particular configuration is more expensive in its current region and now you want to find a cheaper alternative in a different region.
Let’s take the example of N. California and Oregon. In some configurations, N. California can be 23% more expensive compared to N. Virginia. But Oregon is the same price as N. Virginia. Let’s say I can deploy most of my components in Oregon, but I’m concerned about latency.
I ran a test that measures latency between EC2 instances in different regions. The table below shows the average time in milliseconds it took for an EC2 instance in region A to receive a ping response from an EC2 instance in region B. My sample size is 1,000 requests per each calculated value.
A word of caution: there are many factors that can affect latencies, which can vary significantly depending on when you execute a test, AZs and even the specific EC2 instances the test was executed on. Therefore, I only take these tests as a very high level reference.
Sydney is the region that performed the worst. It took an average of 434ms to ping EC2 instances in other regions. It was followed by Sao Paolo with 415ms and Singapore with 388ms.
Latency between Oregon and California was 41ms. Given that N. California compute costs are in some cases 30% higher than Oregon, moving compute power from N. California to Oregon might be a suitable alternative - if your application can tolerate an extra latency of 41ms. For some reason, this test execution showed a latency of 375ms between N. California and Oregon, which was unusually high.
Overall, Ohio and N. Virginia offer the best latency between two regions (23ms), which makes Ohio a great option as a failover region for applications deployed in N. Virginia.
I ran a similar test, but this time uploading a 1MB file from EC2 to S3. Ohio showed the best intraregion EC2-to-S3 transfer time across all regions, with 81ms.
… and one for 10MB from EC2 to S3. Ohio showed the best intraregion EC2-to-S3 transfer time across all regions, with 356ms.
Consider the type of resource that is most important to you (i.e. compute, data transfer, latency, storage, etc.)
From the ELB/EC2 example in this blog post, we could see a maximum price difference of 65% in a typical ELB and EC2 architecture. But if we look closer at specific resource requirements, the price differences can be even steeper.
For example, 1TB of EC2 data transfer out to the internet costs $250 in Sao Paolo, compared to $90 in N. Virginia (a 177% difference!)
Or take a t2.large EC2 instance. If you launched one in Sao Paolo, you would pay 72% more compared to N. Virginia. If you thought N. California would be the same price as N. Virginia, you would actually pay 30% more.
That’s why it’s important that you understand what type of AWS resources your applications consume the most, so you can make a much better decision regarding your AWS region.
Not all services are available in all regions (some take a VERY long time before they are)
Let’s say you have a stable deployment in the N. California region and you are happy with EC2, Auto Scaling and S3 (although you would probably pay 30% more in EC2 compared to other US regions). Do you want to create a serverless microservice that integrates with your existing applications in N. California? Well, you would have had to wait 500 days for API Gateway to be available in N. California (Nov 21st, 2016) from the day it was first announced (July 9th, 2015). Or more than 2 years for Lambda (November 21st, 2016) from the day it was first announced in N. Virginia (November 13th, 2014).
This can be a serious issue for your application, especially if you have a multi-region deployment and suddenly realize you don’t have all the AWS components you need in all the regions your application will be deployed to.
I put together the following table, which tracks AWS services that were announced in 2015 and the dates in which they were released in different regions:
And this table tells you how many days each region has been without a particular service, as of December 31st, 2016.
N. Virginia is the only region where all services are available from day 1. Of these services, Sao Paolo is the region where they’ve taken the longest to become available (average of 472 days, if at all), followed by N. California (361 days) and Singapore (311 days).
Ireland and Oregon are the two regions that follow N. Virginia in terms of feature availability.
Not all regions have the same number of Availability Zones
While all regions have at least 2 Availability Zones, the number of AZs varies by region. For example, North California has 3 Availability zones, while North Virginia has 5 AZs. Actually N. Virginia is the only region with 5 AZs. Seven regions have 3 Availability Zones and six regions have only 2 Availability Zones.
Why does this matter? If you are building an application with strict availability requirements, you should probably stay away from those six regions that only have 2 Availability Zones. If one AZ in those regions is temporarily unavailable (which can happen - for example June 4th, 2016) you would be left with only 1 AZ to process all your transactions. When there is only 1 AZ left, there will be various failover mechanisms triggered by AWS and by other customers, bringing more load to that one AZ, which will put your application in a potentially risky situation.
Basically, if you have high availability requirements then you should stick to those regions with 3 AZs (Tokyo, Sao Paolo, N. California, Ireland, Sydney, Oregon, Ohio) or N. Virginia, which has 5 AZs.
All data transfer between AWS regions costs the same, except for one region
Let’s say you want to create data backups between regions. Your main region is N. Virginia and you want to copy all your data to a different region. You would pay $0.02 per GB of data transferred to any region in the world, except Ohio. For Ohio, you would pay $0.01 per GB. This is makes Ohio the best option for data backups for N. Virginia, together with an expected lower latency.
- Building applications that will reliably grow starts with choosing the right AWS region.
- Not all regions are created equal! There are substantial differences in price, performance, number of AZs and product selection among AWS regions.
- If you want to have the cheapest prices, best selection of products and highest number of Availability Zones, it really comes down to N. Virginia. This region is followed closely by Ireland, Oregon and now Ohio.
- Sometimes there are requirements that may force you into using a particular region, such as compliance and latency. Barring these, you should stick to any of these 4 regions, preferably N. Virginia.
- Choosing any region outside of N. Virginia, Ireland, Oregon or Ohio means you will likely have only 2 AZs, probably pay more and you will have to wait several weeks - even months - before new services are available.
- Of all regions, Sao Paolo is the one I’d recommend the least. Most architectures would cost almost double compared to the cheapest AWS regions and it has ranked last in all of my inter-region latency tests - plus, you would have to wait several months before new services are available in it.
- N. California is the US region I’d recommend the least. EC2 charges can be 30% more expensive compared to N. Virginia and it also takes several months before new services are available in it. It took roughly two years before Lambda and API Gateway were available in this region. IoT took roughly one year and Machine Learning is not yet available. It took 117 days before ECS became available here.
- Ohio is a very interesting region to implement failover for N. Virginia. Oregon has been a very popular region for this purpose, so it’s good to have a new alternative with better latency and the lowest data transfer cost from N. Virginia. Ohio also has a decent service selection. Just keep in mind that there are some missing services compared to N. Virginia.
As you can see, there are a lot of factors to consider when choosing the right AWS region. Not everything is about proximity to your end users. Choosing your AWS region wisely can save you the pain of overspending thousands of dollars and potentially hindering the growth of your applications.