Spread servers and DB across two availability zones An availability zone (AZ) is a group of data centers within a region with its own power, cooling and network. Zones are physically apart, so a power cut or fire in one does not spread to another.
There is one web server per zone. The DB has a primary in zone A and a standby in zone B. The load balancer spreads requests across both web servers.
Writes to the primary are replicated to the standby Both web servers write orders to the primary DB. The primary replicates each write to the standby. The standby takes no requests in normal times. It only follows along.
Multi-AZ setups for managed DBs usually use synchronous replication. The primary says "saved" only after the standby has it too, so confirmed orders survive on the standby even if the primary stops.
Zone A goes down entirely Zone A has a power failure. Web server A and the primary DB stop responding at the same time.
The load balancer does not know yet. Requests sent to web server A fail, and web server B cannot write to the primary DB either, so orders fail.
The load balancer drops server A via health checks At set intervals, the load balancer asks each server "are you alive?". This is a health check. After a set number of consecutive failures, it marks the server unhealthy and stops sending it traffic.
Detection takes interval × count. Some requests arriving during that time can fail.
The standby DB is promoted to the new primary The managed DB service detects that the primary is not responding and raises the standby to be the new primary. This is called promotion, and the whole switch is called failover.
The app keeps using the same connection address, which now points to the new primary. But dropped connections must be reopened by the app, so it needs retry handling.
RPO: how much data can you afford to lose? RPO (Recovery Point Objective) is the maximum window of data you can afford to lose in an outage. If "losing up to the last 5 minutes is acceptable", the RPO is 5 minutes.
This time it was synchronous replication, so confirmed orders are already on the standby. With asynchronous replication, you could lose a short stretch since the last replication.
RTO: how soon must service come back? RTO (Recovery Time Objective) is the maximum time allowed for service to come back after it stops.
This time, the downtime equals the health check detection time plus the DB promotion time. It recovered automatically with no human action.
Key idea RPO is "how much you lose". RTO is "how long you are down". The shorter you make them, the more standby resources you need, and the higher the cost.
If everything were in one zone If the servers and DB were all in zone A, the whole service would stop the moment zone A goes down. There is no standby to take over.
You would have to rebuild from backups kept elsewhere, so the RTO stretches to hours, and everything since the last backup is lost.
Two zones let you survive a single-zone outage Spread across multiple availability zones, health checks and DB promotion hand work over automatically when one zone goes down. When zone A comes back, its DB becomes the new standby.
The cost is the extra standby resources. To survive an entire region outage, you need a separate disaster recovery (DR) design with replication to another region.
Summary Spread across multiple availability zones, service continues through one zone's outage thanks to health checks and standby promotion. In Kubernetes, check a node's zone with the topology.kubernetes.io/zone label and spread Pods evenly across zones.