Regions and Availability Zones

4.More Than One Store in Town

A

In this chapter

We'll learn how cloud providers organise their data centres — regions and availability zones — and how spreading a system across zones keeps it running when one building fails, explained as a supermarket chain with several stores in each city.

12–14 min

The Problem in Real Life

Anna opens a cloud provider's console for the first time. Before she can create anything, it asks her to choose: Region: Europe (London), Europe (Frankfurt), US East... and later, Availability zone: a, b or c.

"This," John says, "is the answer to Samantha's question. Sunday happened because we had one building. Here, you choose how many buildings you're in."

J

Servers die. Buildings lose power. Plan for it, and it's just a Tuesday.

John

Everything in One Building vs. Spread Across Separate Buildings

Whole buildings fail

Power cuts, floods, fires and broken storage systems can take out a whole data centre.

Distance means delay

Fans in London get a faster site if the servers are near London (Act 12).

Some data must stay put

Laws can require personal data to stay in a certain country or region.

Regions, Availability Zones and High Availability

The supermarket analogy: a big supermarket chain has stores in many cities. Inside each city, it has several stores in different neighbourhoods, each with its own power supply and staff, but close enough that a customer can easily go to another one. If one store floods, shoppers walk to the next. If a whole city has a disaster, the chain still runs elsewhere. Cloud providers organise their data centres the same way.

  • Region — a city: a region is a geographic area where the provider has data centres, like Europe (London), Europe (Frankfurt) or US East (Virginia). Each region is independent of the others. You choose regions close to your users (lower latency) and in places that satisfy data laws (for example, keeping European customers' data in Europe).
  • Availability zone (AZ) — a separate store in the same city: each region has several availability zones (usually three or more). An AZ is one or more data centres with its own power, cooling and networking, a few kilometres from the others — far enough that a fire, flood or power cut in one shouldn't affect another, close enough to be connected by very fast private links (a millisecond or two apart).
  • Multi-AZ — being in two stores at once: if you run copies of your system in two or more zones, one zone can fail completely and the others keep serving. This is the redundancy idea from Act 14 (two engines on a plane), applied to whole buildings. The load balancer (Act 14) spans the zones and sends traffic only to healthy copies.
  • Multi-region — for when a whole city goes down: a whole region failing is rare but possible. Running fully in two regions is complex and expensive, so most companies instead keep backups copied to a second region, so they can rebuild there if they ever must.
Table — What happens if...
FailureSupermarket versionOld BlueTicketNew BlueTicket
One server diesOne till breaksPartly downLoad balancer skips it
A storage system fails (Sunday)One store floodsDown 6 hoursOther zone keeps serving
A whole zone loses powerOne store closesDownStandby database promoted in ~1 minute
A whole region failsThe whole city closedDownDown, but data safe; rebuild in Frankfurt
Table — Region vs. availability zone
FeatureRegionAvailability zone
AnalogyA cityA separate store in that city
ExampleEurope (London)London zone a, b, c
Distance apartHundreds of kilometres or moreA few kilometres
Choose forUsers' location, data lawsSurviving a building failure

BlueTicket across two availability zones

Load balancer

spans both zones, sends traffic to healthy copies

Region: Europe (London)

Zone A

2 app containers · main database · Redis

Zone B

2 app containers · standby database · Redis replica

every day + point-in-time

Backups copied to Europe (Frankfurt)

in case the whole region is lost

BlueTicket's new layout: the region is Europe (London), close to most fans. App containers: at least two copies in zone A and two in zone B, behind one load balancer that spans both. Database: a managed PostgreSQL with the main database in zone A and a standby in zone B, kept up to date continuously; if zone A fails, the standby is promoted automatically in about a minute (Act 14's failover). Redis: also with a replica in the other zone. Backups: automatic daily backups plus point-in-time recovery (restore to any second in the last 7 days), with copies sent to a second region (Frankfurt).

Anna's honest answer to Samantha: "If a disk, a server or a whole building fails — like Sunday — we keep running, maybe with a minute of slowness. If the whole London region failed, we'd be down, but our data is safe in Frankfurt and we could rebuild in a few hours. And we'd never lose six hours of orders again, because we can restore to any second, not just 3 AM." Samantha nods. "That's the first technical answer I've ever fully understood."

Key Takeaway

Cloud providers group data centres into regions (cities — chosen for closeness to users and data laws) and availability zones (separate buildings within a region, with their own power and networking). Running copies in two or more zones keeps you up when one building fails; backups copied to a second region protect you if a whole region fails. Sunday's outage was one building — multi-AZ makes that a non-event.

Why This Matters

Regions and availability zones are the cloud's main tool for high availability, and "is it multi-AZ?" is one of the first questions asked about any production system. Understanding them lets you read architecture diagrams, reason about what an outage can and can't take down, and give honest answers like Anna's.

The plan uses words like "load balancer that spans zones", "managed database" and "backups to another region". Before building it, Anna wants to know what each of those cloud building blocks actually is.