Skip to main content

How to build a multi-region active-active app on AWS

Architect a multi-region active-active app on AWS using DynamoDB global tables, Route 53 latency routing, and health-based failover, with outage testing.

Difficulty
Advanced
Duration
60 minutes
Steps
6

A multi-region active-active architecture runs your application in two or more AWS regions simultaneously, serving users from whichever is closest and surviving a full region outage. The hard parts are data replication and traffic routing.

Prerequisites

  • An AWS account and an app you can deploy identically per region.
  • Terraform.

Steps

1. Deploy to two regions

Provision the same stack (compute, API, data layer) in, say, us-east-1 and eu-west-1. Use Terraform workspaces or per-region modules so the definitions stay identical.

2. Replicate data

For DynamoDB, enable global tables so writes in one region replicate to the others within seconds:

resource "aws_dynamodb_table" "orders" {
  name         = "orders"
  billing_mode = "PAY_PER_REQUEST"
  hash_key     = "pk"
  stream_enabled = true
  replica { region_name = "eu-west-1" }
}

Design for eventual consistency and last-writer-wins conflict resolution.

3. Add Route 53 routing

Use latency-based routing records so each user resolves to the region with the lowest latency for them.

4. Configure health checks

Attach a Route 53 health check to each region's endpoint. When a region's health check fails, Route 53 stops returning its record.

5. Handle failover

Because data is replicated and routing is health-aware, a failed region's traffic shifts automatically to the healthy one. Keep both regions warm so the survivor can absorb full load.

6. Test a region outage

Simulate failure by failing the health check (block the endpoint) and confirm traffic moves to the other region.

Verification

Resolve the app domain from clients in different geographies and confirm they reach the nearest region. Write a record in one region and read it from the other to confirm replication. Force a region's health check to fail and confirm requests succeed against the surviving region.

Next Steps

Add region-aware caching, test failback when the region recovers, and run regular game days to rehearse outages. Document the recovery time and data loss objectives you actually achieve.

Prerequisites

  • AWS account
  • An app deployable per region
  • Terraform installed

Steps

  • 1
    Deploy to two regions
  • 2
    Replicate data
  • 3
    Add Route 53 routing
  • 4
    Configure health checks
  • 5
    Handle failover
  • 6
    Test a region outage