FreeReference architectureAWSRoute 53
Multi-region failover
In one sentence: Run a second copy of your system far away, keep its data in sync, and let DNS switch users over when the first one fails.
Animated diagrams are not available for printing. Get StackKinetic Pro to download this explainer.
Inspect:
Read this explainer as text
Normal day
Beginner
- You open the app. Your device asks the switchboard where to go.
- The main copy is healthy, so it sends you there.
- You connect to the main copy of the app.
- The app saves your change in the main database.
- A copy of that change is sent to the faraway replica straight away.
- The database confirms it’s saved.
- All done. The spare copy has been quietly kept up to date.
Practitioner
- The client resolves the app’s domain name.
- DNS answers with the primary region’s address.
- The client sends its request to the primary region.
- The app writes to the primary database.
- The change is replicated to the standby region.
- The primary database acknowledges the write.
- The response returns from the primary region.
Architect
- DNS query for the app hostname.
- Primary record returned because its health check is passing.
- Request hits region A’s load balancer.
- Write committed on the primary cluster.
- Asynchronous cross-region replication, typically under a second of lag.
- Commit acknowledged without waiting for the replica (async).
- Response served; the standby is warm and its data is seconds behind.
Region outage
Beginner
- The switchboard checks on the main copy, like it does every few seconds. No answer.
- It checks the spare copy. That one’s healthy, so the switchboard flips over.
- You open the app and ask where to go.
- The switchboard sends you to the spare copy.
- You connect to the spare copy, far away.
- The replica becomes the main database and starts accepting changes.
- Your data is there, almost exactly as you left it.
- The app works again. A whole region failed, and you barely noticed.
Practitioner
- A DNS health check to the primary region fails.
- The standby passes its health check, so DNS fails over.
- The client resolves the domain again.
- DNS answers with the standby region’s address.
- The client connects to the standby region.
- The replica is promoted and handles the request.
- The database returns the data.
- The user is served from the standby region.
Architect
- Health checks from multiple locations fail past the threshold.
- Failover record activates; secondary becomes the answer.
- New query (or the old answer’s low TTL expires).
- Secondary record returned.
- Traffic lands on region B; autoscaling ramps it up.
- Replica promoted to writer; recent changes may be lost up to the replication lag (RPO).
- Read/write served from the promoted cluster.
- Recovery time is health-check detection plus DNS TTL plus scale-up.
Now add…
Take it with you
Pro adds video downloads, with embeds and editable source coming soon. Core explainers are always free to watch.