SkillSprout
Chapter 11 · Lesson 2
Intermediate
7 min read

Multi-AZ

Overview

An Availability Zone (AZ) is one or more discrete data centres with independent power, cooling and networking inside an AWS Region. Multi-AZ designs spread your application and data across at least two AZs so that the loss of one AZ does not take the application offline.

For stateless compute this is straightforward: put EC2 instances in an Auto Scaling group across several AZs behind a load balancer. For databases it takes more work, because data must be copied between AZs. Managed services such as RDS Multi-AZ and Aurora do that automatically, including automatic failover to a standby.

Multi-AZ provides high availability (HA) and is the first level of resilience for production workloads. Remember that it does not protect against accidental data deletion (use backups) or a Regional outage (use cross-Region designs).

Key Concepts

  • RDS Multi-AZ instance deployment keeps a synchronous standby in another AZ; failover is automatic (typically 60-120 seconds) and the endpoint DNS name stays the same.
  • The Multi-AZ standby is not readable; it exists purely for HA and does not scale reads. Read replicas are for scaling reads.
  • RDS Multi-AZ DB cluster (MySQL/PostgreSQL) has one writer and two readable standbys across 3 AZs with faster failover (about 35 seconds or less).
  • Aurora stores 6 copies of data across 3 AZs, tolerates loss of 2 copies for writes and 3 for reads, and fails over in typically under 30 seconds; up to 15 read replicas.
  • ELB and Auto Scaling distribute traffic and instances across AZs; the ASG replaces unhealthy instances and rebalances AZs.
  • S3 Standard, DynamoDB, EFS (Standard) and SQS are inherently multi-AZ; EBS volumes and One Zone classes live in a single AZ.
  • ElastiCache (Redis/Valkey) supports Multi-AZ with automatic failover to a replica; NAT gateways are per-AZ and need one per AZ.
  • Failover triggers: AZ outage, primary instance failure, OS patching, instance class change, or a manual reboot with failover.

Detailed Notes

The principle

Each AZ is a separate failure domain, connected to others with low-latency, high-bandwidth links (typically single-digit milliseconds). Design every tier so any one AZ can disappear and the remaining AZs handle the load.

TierMulti-AZ technique
DNSRoute 53 (global, resilient)
Load balancingALB/NLB with subnets in at least 2 AZs (cross-zone load balancing)
ComputeAuto Scaling group spanning AZs; health checks replace instances
Network egressOne NAT Gateway per AZ
DatabaseRDS Multi-AZ, Aurora, DynamoDB
Shared filesEFS Standard (multi-AZ mounts), FSx Multi-AZ
CacheElastiCache with Multi-AZ replicas

RDS deployment options

OptionStandbysReadable?FailoverNotes
Single-AZ0n/anoneDev/test only
Multi-AZ instance1 (sync)No~60-120 sAll RDS engines; same endpoint after failover (DNS CNAME flip)
Multi-AZ DB cluster2 (semi-sync)Yes (reader endpoint)~35 sMySQL and PostgreSQL; commit latency improvements
Aurora clusterup to 15 replicasYes< 30 s (often ~10-20 s)Shared storage across 3 AZs

In Multi-AZ instance mode RDS uses synchronous block-level (or engine-level, for SQL Server mirroring/AG) replication. Maintenance such as patching the OS happens on the standby first, then fails over, minimising downtime. Backups are taken from the standby, so there is no I/O freeze on the primary.

Your application always connects through the DNS endpoint. Keep connection retry logic and a low DNS TTL, because the endpoint flips to the standby's IP on failover.

bash
aws rds create-db-instance --db-instance-identifier orders --engine postgres \
  --db-instance-class db.m6g.large --allocated-storage 100 \
  --master-username admin --manage-master-user-password --multi-az
aws rds reboot-db-instance --db-instance-identifier orders --force-failover

Aurora storage

Aurora separates compute from a distributed storage volume that automatically replicates 6 copies across 3 AZs. Writes need 4 of 6 copies; reads need 3 of 6. Storage self-heals in 10 GB segments. Replicas share the same storage, so promoting a replica is fast. Use Aurora Replicas (priority tiers 0-15) as failover targets; with none, Aurora creates a new instance (slower).

Stateless compute across AZs

yaml
Resources:
  WebAsg:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      MinSize: "2"
      MaxSize: "6"
      VPCZoneIdentifier: [!Ref PrivateSubnetA, !Ref PrivateSubnetB, !Ref PrivateSubnetC]
      TargetGroupARNs: [!Ref WebTargetGroup]
      HealthCheckType: ELB

With ELB health checks enabled the ASG replaces instances the load balancer considers unhealthy, and it rebalances to maintain even AZ distribution.

Things that are NOT automatically multi-AZ

  • EBS volumes (single AZ) - use snapshots, or use EFS for shared storage.
  • EC2 instances themselves - you must run multiple.
  • S3 One Zone-IA, EFS One Zone, single-AZ RDS.
  • Single NAT gateway - failure of its AZ removes outbound access for other AZs.
  • Instance store data - lost on failure.

Multi-AZ vs. read replicas

Multi-AZRead replica
PurposeHigh availability / DR within RegionRead scaling, cross-Region DR
ReplicationSynchronousAsynchronous
ReadableNo (instance deployment)Yes
FailoverAutomaticManual promotion
Cross-RegionNoYes

Read replicas can also be Multi-AZ and promoted to standalone databases.

Real World Example

Scenario — a hospital patient portal must stay online during an AZ failure.

The portal serves clinicians 24/7. The architects deploy it in ca-central-1 across three AZs:

  • An Application Load Balancer with subnets in all three AZs and cross-zone load balancing enabled.
  • An Auto Scaling group (min 3) with ELB health checks; instances spread evenly across AZs.
  • Aurora PostgreSQL with a writer and two replicas in different AZs; the cluster endpoint always points to the writer.
  • One NAT Gateway per AZ and a gateway endpoint for S3.
  • ElastiCache with Multi-AZ replicas for session data.

During a power event in one AZ, the ALB stops sending traffic to its instances, Aurora promotes a replica in another AZ in under 30 seconds, and the ASG launches replacement instances in the surviving AZs. Users see a brief reconnect but no data loss, and the team uses a GameDay with AWS Fault Injection Service to prove it regularly.

Architecture Diagram

Multi-AZ web application with Multi-AZ database
Architecture
AWS Cloud
Users
Region
Application Load Balancercross-zone
VPC
Availability Zone A
App subnet
EC2ASG member
Data subnet
RDS primaryactive
Availability Zone B
App subnet
EC2ASG member
Data subnet
RDS standbyautomatic failover

Load balancer and Auto Scaling span AZs; the database fails over to a standby in the other AZ.

  1. 1Users reach the Application Load Balancer, which spreads requests across healthy instances in both AZs.
  2. 2Auto Scaling keeps instances balanced between AZs and replaces failed ones.
  3. 3The application writes to the RDS primary, which synchronously replicates to the standby in the other AZ.
  4. 4If AZ A fails, RDS promotes the standby, the endpoint DNS name points to the new primary, and the ALB uses the surviving instances.

Best Practices

  • ✓Run every production tier in at least two (preferably three) AZs and size for N-1 AZ capacity.
  • ✓Enable Multi-AZ for all production databases; consider Aurora or Multi-AZ DB clusters for faster failover.
  • ✓Use ELB health checks with Auto Scaling and enable cross-zone load balancing.
  • ✓Deploy one NAT Gateway per AZ and route each private subnet to its local NAT.
  • ✓Connect through DNS endpoints, implement retries and low DNS TTLs so failover is seamless.
  • ✓Avoid single-AZ dependencies: EBS-only state, One Zone storage classes, single NAT, single bastion.
  • ✓Test failover with reboot --force-failover and AWS Fault Injection Service before you need it.
  • ✓Pair Multi-AZ with backups and, where required, cross-Region replication.

Common Interview Questions

Exam Tips

SAA-C03 focus

  • High availability within a Region -> Multi-AZ. It does not help with Regional failure (needs cross-Region).
  • RDS Multi-AZ = synchronous replication, automatic failover, same endpoint, standby not readable.
  • Scale reads -> read replicas (async). HA/failover -> Multi-AZ. Don't mix them up.
  • Aurora: 6 copies across 3 AZs, up to 15 replicas, failover < 30 seconds.
  • A VPC spans AZs, a subnet is in one AZ; an HA design needs subnets in several AZs.
  • EBS and instance store are AZ-bound. For shared multi-AZ file storage use EFS Standard.
  • ASG with ELB health checks replaces unhealthy instances and balances across AZs.
  • One NAT Gateway per AZ for resilience; S3 and DynamoDB are natively multi-AZ.

Finished this lesson?

0 of 64 lessons done · 0% of the course