SkillsCloud computing

Regions and zones

Where the computers actually are, and how regions and availability zones keep a service running when a building fails.

Topic 6 of 105 min read

Every server you rent is in a real building in a real place. Where that place is decides how fast your application feels to users, which laws apply to your data, and whether your service stays up when something goes wrong.

This topic covers how providers arrange their data centres into regions and availability zones, why that design keeps services running, and how to choose where to run. By the end you can explain the difference between a region and a zone, and why serious applications run in more than one zone.

Regions

Region: A separate geographic area, such as a city or part of a country, where a provider runs a group of data centres.

Large providers have dozens of regions around the world, each with a name and a short code.

Regions are kept independent of each other. A problem in one, a power cut, a software fault, a natural disaster, should not spread to another. Your resources live in the region you choose, and nothing moves to another region unless you move it.

When you create almost anything in the cloud, you pick a region first. Four things usually decide which one:

  1. Distance to your users. Data travels at a fixed speed through fibre, so a region close to your users answers faster. A round trip across a continent can take 50 to 100 milliseconds; across town, a few.
  2. Rules about data. Some laws require personal data to stay inside a country or a group of countries. Choosing a region there keeps it in place.
  3. Which services exist there. New services usually start in a few regions and spread later.
  4. Price. The same server can cost a different amount in different regions.

Availability zones

Availability zone (AZ): One or more data centres inside a region with their own power, cooling and network connections, kept apart from the region's other zones so they rarely fail at the same time.

A region usually has three or more zones.

Zones in a region are a few kilometres to tens of kilometres apart: far enough that a fire, flood or power cut is unlikely to hit two at once, close enough that they are joined by fast private links with only a millisecond or two between them.

 Region
 ┌──────────────────────────────────────────────────────┐
 │  Zone A              Zone B              Zone C       │
 │  ┌────────────┐      ┌────────────┐      ┌──────────┐ │
 │  │ data       │      │ data       │      │ data     │ │
 │  │ centre(s)  │══════│ centre(s)  │══════│ centre(s)│ │
 │  └────────────┘      └────────────┘      └──────────┘ │
 │     own power, cooling and network in each zone       │
 └──────────────────────────────────────────────────────┘

Why this design matters

Power supplies, cooling systems and network links break, and sometimes a whole data centre goes offline. Zones are arranged so that one such failure takes out only one zone.

Your part is to use that. If your application runs on one server in one zone, it goes down when that zone does. If it runs on servers in two or three zones, with a load balancer sending users to whichever are healthy, the loss of one zone barely shows.

SetupSurvives a server failingSurvives a zone failingSurvives a region failing
One server, one zoneNoNoNo
Several servers, one zoneYesNoNo
Several servers, several zonesYesYesNo
Copies in two regionsYesYesYes

Running across several zones is the normal choice for anything that matters, and costs little more. Running in several regions is much harder and more expensive, and is kept for services that must survive even a whole region failing.

Edge locations

  • Edge location: A small provider site, in many more cities than there are regions, that keeps content and services close to users. Your servers do not run there.
  • Content delivery network (CDN): A network of edge locations that keeps copies of content, such as images and pages, near users, so they load quickly even far from your region.

Tasks

Task 1: Pick a region

Most of a company's customers are in one country. Personal data about them must, by law, stay in that country. The provider has a region in that country and a cheaper one in a neighbouring country, 1,500 km away. Which do you choose, and why?

Check your work

The region in the country. The law about personal data decides it, whatever the price. It is also closer to the customers, so the application will be faster. Price matters only between regions that already meet the rules.

Task 2: Plan for failure

An online shop runs on two servers in the same zone and a database in that zone too. Explain what happens if that zone loses power, and how you would change the setup.

Check your work

The whole shop goes down: both servers and the database are in the failed zone. Spread the servers across two or three zones behind a load balancer, and run the database with a standby copy in a second zone that takes over automatically. Losing one zone then leaves the shop running.

Quiz

1. What is the difference between a region and an availability zone?

Show answer

A region is a geographic area containing several availability zones. An availability zone is one or more data centres inside a region, with its own power, cooling and network, separated from the other zones so they rarely fail together.

2. Why are zones in a region close together, but not too close?

Show answer

Close enough to be joined by fast, low-latency links, so an application can spread across them and still work as one. Far enough apart that one fire, flood or power cut is unlikely to hit more than one.

3. Your application runs in three zones. Does that protect it if the whole region has a problem?

Show answer

No. All three zones are in the same region. To survive a region-wide problem you need a copy of the application and its data in a second region, which is much more work and cost.