Multi-region and disaster recovery
In one line
Start from how much data you can lose (RPO) and how long you can be down (RTO); those two numbers decide between backups, a warm standby region and full active-active, and each step up costs more money and more consistency trade-offs.
What it is
Disaster recovery (DR) is the plan for surviving the loss of a whole data centre or cloud region: power or network failure, a bad config pushed everywhere, a cloud control-plane outage, or deleted data. Running in several availability zones (AZs) inside one region handles most hardware failures; multi-region designs handle the rarer, bigger events.
Two numbers define every DR plan. RPO (recovery point objective) is how much recent data you can afford to lose, for example 'at most 5 seconds of payments'. RTO (recovery time objective) is how long the service may be down, for example 'back within 15 minutes'. A design with RPO = 0 needs synchronous replication across regions, which adds the inter-region round trip to every write.
The common strategies, from cheapest to most expensive: backup and restore (hours of RTO), pilot light (data replicated, minimal compute kept off or tiny), warm standby (a scaled-down copy running, ready to scale up), and multi-site active-active (all regions serve traffic). Active-active has the best RTO but forces you to handle writes in two places at once, which means conflict resolution or partitioning users by home region.
Why interviewers ask
At senior levels, 'what if the whole region goes down?' is a standard follow-up. Interviewers want you to state RPO and RTO, explain the cost of synchronous vs asynchronous replication, handle failover without split brain, and know that DR you never test does not work. In India there is an extra twist: RBI's 2018 data-localisation rule requires payment system data to be stored only in India, so payment companies build DR between Indian regions (for example AWS Mumbai and Hyderabad) instead of failing over abroad.
How it works
- 1Agree RPO and RTO per data set and journey with the business. Payments ledger: RPO near 0, RTO 15 minutes. Product catalogue: RPO 1 hour (can be rebuilt), RTO 1 hour. Analytics: RPO 24 hours.
- 2First get multi-AZ right in one region: replicas in at least 2-3 AZs, load balancers across AZs, no single-AZ dependencies. This handles most real outages at low cost.
- 3Back up everything to another region, and protect backups from deletion (separate account, object lock). Backups also cover the most common 'disaster': bad code or a human deleting data, which replication would copy instantly.
- 4Choose replication: asynchronous cross-region replication gives low write latency but loses the last seconds of writes on failover (RPO = replication lag). Synchronous replication or consensus across regions (Spanner, CockroachDB, a 3-region Raft group) gives RPO 0 but every write waits for another region, adding tens of milliseconds.
- 5Choose the traffic model. Active-passive: one region takes writes, the other is standby. Active-active with home regions: each user or tenant is pinned to one region for writes, so there are no conflicts. Active-active multi-writer: any region writes and conflicts are resolved by last-writer-wins, CRDTs or application logic.
- 6Route traffic with DNS (health-checked records with short TTLs like 30-60 s), global anycast load balancers, or client-side region lists. Remember that some resolvers and apps ignore low TTLs.
- 7Make failover safe: promote the standby database only after the old primary is fenced (cannot accept writes), to avoid split brain where both regions take writes and diverge.
- 8Keep the standby honest: same code version, same config, enough capacity (or pre-approved quota to scale up), and secrets and certificates already present.
- 9Prefer static stability: the standby should be able to serve without calling control-plane APIs of the failed region, because those are often affected by the same outage.
- 10Test regularly with game days: fail over a real service, measure actual RTO and RPO, and fix what breaks. Many teams find hard-coded endpoints and missing permissions only during a test.
Worked example · Warm standby for a payments ledger under data localisation
- Requirements: RPO under 5 seconds, RTO under 15 minutes, all data in India. Primary: AWS Mumbai (ap-south-1). DR: AWS Hyderabad (ap-south-2).
- Write load: 3,000 ledger writes per second at peak. Mumbai to Hyderabad round trip is roughly 20-30 ms. Synchronous cross-region commit would add that to every write and cut throughput per connection; the team chooses async replication with lag alerts at 2 seconds.
- Normal state: Postgres primary plus two replicas across 3 AZs in Mumbai; an async replica in Hyderabad with typical lag under 1 second. Hyderabad runs 20% of the application capacity, already deployed and passing health checks.
- Disaster: Mumbai becomes unreachable at 21:00. At 21:02 automated checks from a third location confirm it; at 21:04 the on-call engineer approves the runbook.
- Fence the old primary: Mumbai's database security group and credentials are revoked via a control path that does not depend on Mumbai, so if Mumbai returns it cannot accept writes.
- Promote the Hyderabad replica (about 1 minute), scale application capacity from 20% to 100% (about 5 minutes with pre-warmed nodes and reserved quota), and switch DNS (60 s TTL). Service is back at about 21:12: RTO about 12 minutes.
- Data loss: the last ~0.8 seconds of commits, about 2,400 ledger entries, were not replicated. Because every payment also has a record at the bank or UPI switch, a reconciliation job matches them by transaction ID after recovery. The design accepts a small RPO because reconciliation exists, not by accident.
Picture it
A shop with two branches in different cities. Backup and restore is keeping copies of the account books in the other city's bank locker. Warm standby is a second branch that is open with a small staff and an up-to-date copy of the stock list, ready to take all customers if the main branch floods. Active-active is both branches fully open; it serves more customers, but if both sell the last unit of the same item, someone has to sort it out.
Key patterns
Home region per user or tenant
When: Active-active without write conflicts
How: Store each user's home region; route their writes there. Reads can be served locally from replicas. Move a user's home only through a controlled migration.
Cell-based architecture
When: Limiting blast radius inside and across regions
How: Split the system into independent cells, each serving a slice of users with its own data and services. A bad deploy or failure hits one cell, not everyone.
Fencing on failover
When: Promoting a standby database
How: Make the old primary unable to accept writes (revoke credentials, block network, use an epoch number that storage checks) before promoting the new one.
Static stability
When: Designing standby regions
How: Pre-provision capacity, config and secrets so failover does not depend on creating resources or calling services in the failed region.
Real-world use
Netflix Chaos Kong
Netflix runs active-active across AWS regions and practises evacuating an entire region by shifting all traffic to the others. Its Chaos Kong exercises simulate a full region failure in production.
AWS us-east-1 outages
Large outages in AWS's us-east-1 region (for example in December 2021) took down many services that ran only in that region or depended on its control-plane APIs, a common lesson in static stability and multi-region readiness.
Google Spanner
Spanner replicates data synchronously with Paxos across zones and regions, giving RPO 0 and external consistency. The cost is write latency that includes the round trip to a quorum of replicas, often in other regions.
Amazon DynamoDB global tables and Aurora Global Database
DynamoDB global tables allow writes in multiple regions and resolve conflicts with last-writer-wins. Aurora Global Database uses asynchronous storage-level replication, typically with about a second of lag, and supports promoting a secondary region.
RBI data localisation
Since 2018 RBI requires payment system data to be stored only in India. Indian payment companies therefore build DR across Indian regions, such as AWS Mumbai and Hyderabad, Google Cloud Mumbai and Delhi, or Azure Pune and Chennai, or across their own data centres.
In a project
A broking platform similar to Zerodha runs entirely in one cloud region. A regulator audit and a two-hour regional network incident during market hours push leadership to ask for a disaster recovery plan before the next budget day, when traffic is 5x normal.
- Classify systems: order placement and positions (RPO about 0, RTO 10 minutes during market hours), market data fan-out (stateless, RPO not relevant), reports and back office (RPO 1 hour, RTO 4 hours).
- Fix single-region weaknesses first: spread across 3 AZs, remove single-AZ caches and NAT gateways.
- For order data, use a database that can replicate to a second Indian region; decide between synchronous commit (adds latency to every order) and async plus reconciliation with the exchange's order book.
- Run warm standby in the second region with the trading gateway connected to the exchange's DR site, configured and tested.
- Store backups in a separate account with object lock to defend against ransomware and accidental deletes.
- Automate failover steps in a runbook tool, with a human approval gate and fencing of the old region.
- Hold quarterly DR drills on weekends and a smaller drill before major market events; measure actual RTO and RPO and fix the gaps.
Impact: The firm can lose its primary region and resume trading within about 10 minutes with a known, reconciled data gap, and can show auditors measured results from drills instead of a diagram.
Trade-offs
Use it when
- The business cost of a regional outage is larger than the cost of a second region (payments, trading, large consumer apps)
- Regulators or enterprise customers require documented, tested DR
- Users are spread geographically and you also want lower latency (active-active)
- Data can be partitioned by user or tenant home region, avoiding write conflicts
Avoid it when
- Multi-AZ in one region already meets the agreed RTO and RPO; multi-region roughly doubles infrastructure and operational cost
- Synchronous cross-region writes when the latency budget cannot absorb an extra 20-100 ms per write
- Multi-writer active-active for data that cannot tolerate conflicts, such as account balances, unless you use a consensus database
- You cannot commit to regular failover tests; an untested DR region gives false confidence
- Failing over to a region outside the country when data-localisation rules apply
Common mistakes
- Saying 'we replicate to another region' without stating RPO, RTO or whether replication is synchronous.
- Treating replication as backup: a bad delete or corrupting bug replicates instantly.
- Automatic failover with no fencing, causing split brain and two diverging primaries.
- Assuming the standby can scale up on demand during a regional outage, when everyone else is also requesting capacity.
- Forgetting dependencies: DNS, identity provider, secrets manager, third-party APIs and CI/CD may all live in the failed region.
- Never testing failover, then discovering hard-coded endpoints during a real disaster.
- Proposing active-active with last-writer-wins for money, silently losing updates.
Interview questions
Quick revision
- RPO = how much data you can lose; RTO = how long you can be down.
- Strategies: backup/restore, pilot light, warm standby, active-active.
- Multi-AZ first; multi-region for regional disasters.
- Async replication: RPO = lag. Sync/consensus: RPO 0, +inter-region RTT per write.
- Replication is not backup; keep immutable cross-region backups.
- Fence the old primary before promoting the new one.
- Active-active needs home regions or conflict resolution.
- Static stability: standby ready without the failed region's control plane.
- RBI localisation: payment data DR stays inside India.
- Untested DR does not work; run game days and measure.
Check yourself
1. A system replicates its database asynchronously to another region with about 2 seconds of lag. What is its RPO for a sudden regional failure?
2. Which DR strategy keeps a scaled-down but running copy of the application in the second region?
3. Why must the old primary be fenced before promoting a standby?
4. Why are cross-region backups needed even with continuous replication?
See it in a full design
These walkthroughs use this lesson.
Saved on this device. Create a free account to keep it on every device.
Practise this with Sam
A real mock interview, out loud, with an honest scorecard. Free to start.