TwiceToldby Develoker
ConceptsSystem designLabsCheat sheetsAbout

Develoker makes free tools for learning to build software. TwiceTold explains each idea twice, as an everyday analogy and the real thing; CloudArch lets you design cloud systems and put load on them.

About ยท Labs ยท Cheat sheets ยท Learning paths

All concepts ยท aws ยท cloud ยท high availability ยท disaster recovery

AWS Regions and Availability Zones

AWS runs separate geographic Regions, each made of at least three isolated Availability Zones with independent power and networking, so you spread a workload across zones to survive a data-centre failure and across Regions for latency, disaster recovery and data residency.

12 min5 animations

๐Ÿ“š Builds on๐Ÿ“š Replication and read replicas

๐Ÿ–จ๏ธ Cheat sheet

A bakery chain in many cities

Picture a bakery chain. It doesn't bake in just one place: it has branches in many cities, far apart, such as Dublin and Tokyo. You choose which city bakes your bread.

Inside each city there are several separate bakeries, at least three. They sit in different parts of town, far enough apart that one flood or fire can't reach two of them, but close enough that a van gets between them in minutes. Each bakery has its own power line, its own water and its own ovens, so a power cut at one doesn't touch the others.

The chain calls each of those separate bakeries an Availability Zone. Press play to see the map.

Regions and Availability Zones

AWS infrastructure is split into Regions: separate geographic areas such as eu-west-1 (Ireland) or ap-northeast-1 (Tokyo). Regions are isolated from each other, and most services run independently in each one. When you create a resource, you choose its Region.

Each Region contains at least three Availability Zones (AZs) (an account may see fewer: newer accounts get two in us-west-1). An AZ is one or more discrete data centres with redundant power, networking and connectivity of its own. Generators and cooling aren't shared between AZs.

TermMeaning
RegionA geographic area, e.g. eu-west-1, isolated from other Regions
Availability ZoneOne or more data centres in a Region, e.g. eu-west-1a, isolated from the other AZs
AZ IDA zone's fixed identifier, e.g. use1-az1, the same in every account

AZs in a Region are up to about 100 km (60 miles) apart: far enough to avoid correlated failures such as floods or power outages, close enough for synchronous replication. They're joined by redundant, high-bandwidth, low-latency fibre, with single-digit millisecond round trips. Traffic between AZs is billed per GB in each direction; traffic within one AZ on private addresses usually isn't.

Regions launched after 20 March 2019 are opt-in: they're disabled in an account until you enable them.

Regions and Availability Zones5 steps
๐Ÿ™๏ธ Dublin๐ŸŒ† Tokyo๐Ÿ™‹Ana๐Ÿ Dublin bakery A๐ŸกDublin bakery B๐Ÿ˜๏ธDublin bakery C๐ŸฏTokyo bakery A๐ŸฏTokyo bakery C๐ŸฏTokyo bakery D
Press play and watch it happen!

Baking in two bakeries at once

If all your bread comes from one bakery, a power cut there means no bread. So you bake in two bakeries in the same city. The order desk sends each order to whichever bakery is working.

The order book matters most. The main bakery keeps it, and a standby bakery copies every new line straight away, before the order counts as done. If the main bakery goes dark, the standby already has every line and takes over. That's called running Multi-AZ.

Multi-AZ for high availability

An AZ is a failure domain: it can lose power or network on its own. A workload in one AZ goes down with it, so production systems spread across at least two, usually three:

  • Compute: an Auto Scaling group across subnets in several AZs, behind a load balancer (ALB or NLB) with nodes in each of them. Health checks stop routing to targets in a failed AZ.
  • Databases: RDS Multi-AZ keeps a synchronous standby in another AZ. A write is acknowledged only after the standby has it, so failover loses no committed data. On failure, RDS flips the endpoint's DNS name to the standby; this typically takes 60 to 120 seconds, and clients must reconnect.
  • Managed services such as S3 (except its One Zone storage classes), DynamoDB and SQS store data across several AZs for you.

Plan capacity so the remaining AZs can carry the load: with two AZs, each must handle 100% on its own. Synchronous replication works here only because AZs are close; it adds a little write latency, and cross-AZ traffic costs money.

Surviving a lost Availability Zone5 steps
๐Ÿ  Bakery A๐Ÿก Bakery B๐Ÿ™‹Customers๐Ÿ›Ž๏ธOrder desk๐Ÿง‘โ€๐ŸณBaker A๐Ÿ‘ฉโ€๐ŸณBaker BMain order bookStandby order book
Press play and watch it happen!

Opening in another city

Some reasons to bake in a second city:

  • Fresh bread for faraway customers. Bread from Dublin takes ages to reach Tokyo. A Tokyo branch bakes it close by.
  • A whole city in trouble. A big storm could close every bakery in one city. A branch in another city keeps going.
  • Rules about order details. Some places say their customers' order details must never leave the country. So you keep European order details in European cities only.

Copying the order book to another city takes a while, so the far copy is always a little behind. If the first city closes suddenly, the last few lines may be missing.

Multiple Regions

Multi-AZ survives a data-centre failure, not a Regional one. Reasons to go multi-Region:

  • Latency: a round trip from Tokyo to Ireland takes far longer than one within Japan. Serve users from a nearby Region, steered by Route 53 latency or geolocation routing, or cache at the edge with CloudFront.
  • Disaster recovery: survive a Regional outage. Strategies range from backup and restore, to pilot light, to warm standby, to active-active, trading cost against recovery time (RTO) and data loss (RPO).
  • Data residency: AWS doesn't move your content out of the Region you chose without your agreement (except as needed to run a service you asked for or to comply with law), so keeping EU personal data in EU Regions helps meet rules such as GDPR.

Replication between Regions (S3 Cross-Region Replication, DynamoDB global tables in their default mode, Aurora Global Database, RDS cross-Region read replicas) is usually asynchronous: distances are too large to wait on every write. (DynamoDB's multi-Region strong consistency mode does wait, and pays for it in write latency.) The replica lags, so a sudden failover can lose the last writes, and active-active writes need conflict handling. Not every service or instance type exists in every Region, and data transfer between Regions is billed.

In Java, each AWS SDK client is bound to one Region when it's built, so multi-Region code builds one client per Region:

1S3Client ireland = S3Client.builder().region(Region.EU_WEST_1).build();2S3Client frankfurt = S3Client.builder().region(Region.EU_CENTRAL_1).build();3 4// No region in code: the default chain checks the aws.region system property,5// then AWS_REGION, then the shared config file, then EC2 instance metadata.6S3Client fromEnvironment = S3Client.create();

With Spring Cloud AWS, set it once in configuration: spring.cloud.aws.region.static=eu-west-1.

Why use more than one Region5 steps
๐Ÿ™๏ธ Dublin๐Ÿฐ Frankfurt๐Ÿ™‹Ana in Dublin๐Ÿ™‹โ€โ™‚๏ธKenji in Tokyo๐Ÿง‘โ€๐ŸณDublin baker๐Ÿ‘ฉโ€๐ŸณFrankfurt bakerDublin order bookFrankfurt copy
Press play and watch it happen!

Chain-wide, city-wide and one-bakery things

Some things belong to the whole chain. The staff badge list works in every city: a badge made once opens doors in Dublin and Tokyo. The chain's phone book tells callers which city to ring.

Some things belong to one city. The city's pantry is shared by all its bakeries, and its sacks are spread across them, so losing one bakery loses no flour. But Dublin's pantry is not in Tokyo.

And some things live in one bakery. An oven stands in one building, and its tray cupboard stands right beside it. If that bakery goes dark, its ovens and cupboards go dark with it. These are called zonal things.

Global, Regional and zonal services

Every AWS resource has a scope, and the scope decides what a failure takes down:

ScopeExamplesFails with
GlobalIAM users and roles, Route 53 hosted zones, CloudFront distributionsRarely; data planes are spread worldwide
RegionalS3 general purpose buckets, DynamoDB tables, Lambda functions, SQS queues, VPCsIts Region
ZonalEC2 instances, EBS volumes, subnetsIts AZ

Regional services replicate across AZs for you. Zonal resources don't: an EBS volume attaches only to instances in its own AZ, and to move one you snapshot it and restore in another AZ. That's why you run several instances across AZs rather than one big one.

S3 is Regional even though bucket names are globally unique: a bucket's data lives in the Region you pick. "Global" services still have a home: the control planes for IAM, Route 53 and CloudFront run in us-east-1. Their data planes (signing in with a role, answering DNS queries) keep working elsewhere if it has trouble, but creating or changing them may fail, so don't make a recovery plan depend on those changes.

Global, Regional and zonal5 steps
๐Ÿ  Bakery A๐Ÿก Bakery B๐ŸชชStaff badge list๐Ÿ“žChain phone bookDublin pantryโ™จ๏ธOven ATray cupboard Aโ™จ๏ธOven B
Press play and watch it happen!

Whose bakery A?

Every customer gets a map of the city with its bakeries marked A, B and C. But in a few of the oldest cities, the chain shuffled the letters for older customers. Ana's bakery A might be Ben's bakery C. That way not everyone piles into bakery A.

So when Ana and Ben want to bake side by side, "let's both use A" can send them to different buildings. Each bakery also has a fixed street address that is the same on every map, called its AZ ID. Ana and Ben agree on the street address instead.

AZ names and AZ IDs

An AZ name such as us-east-1a is a per-account label. In six of the oldest Regions (us-east-1, us-west-1, us-west-2, ap-southeast-1, ap-southeast-2, ap-northeast-1), AWS mapped names to physical zones independently for each account, to spread load evenly, so us-east-1a in one account can be a different data centre from us-east-1a in another. AWS documents that accounts created from November 2025 get the same mapping in those Regions; older accounts keep theirs. Other Regions already map names uniformly.

The AZ ID (use1-az1, euw1-az2) names the physical zone and is the same in every account. Use AZ IDs whenever zones must line up across accounts: sharing subnets with AWS RAM, placing a client next to a service in another account to avoid cross-AZ latency and cost, or reading capacity reports. Look up your mapping with aws ec2 describe-availability-zones, which returns both ZoneName and ZoneId.

AZ names and AZ IDs4 steps
๐Ÿ™๏ธ The city๐Ÿ™‹Ana's team๐Ÿ™‹โ€โ™‚๏ธBen's team๐Ÿ 1 Mill Lane๐Ÿก2 Oak Road๐Ÿ˜๏ธ4 Bridge Street
Press play and watch it happen!

๐Ÿงฉ Quick quiz

Quick quiz! 4 questions about AWS Regions and Availability Zones, told the same way as the story.
  1. Your bread is baked in one Dublin bakery only. That bakery loses power. What happens?
  2. Why can the standby order book copy every line before an order counts as done, but the Frankfurt copy can't?
  3. Every bakery in Dublin closes in one big storm. What keeps the bread coming?
  4. Ana and Ben both pick bakery A to bake side by side. Why might they end up in different buildings?
Answer every question to check.Passing marks AWS Regions and Availability Zones as done.
Got the hang of AWS Regions and Availability Zones? Mark it as done, and your paths show how far youโ€™ve got.

Saved in this browser.

โ˜๏ธ AWS from zeroStep 1 of 12

Next on the path โ†’๐Ÿชช AWS IAM: users, roles and policies

๐Ÿ‘‰ Read next

  • ๐ŸชงAmazon Route 53The city information kiosk that tells visitors which branch of your shop to go to, following your rules.
  • ๐Ÿ˜๏ธAmazon VPC: subnets, route tables and security groupsA gated housing estate with its own house numbers, some streets with a road to the gate and some without.