nodemethod
ResilienceAdvanced

Multi-region active-passive failover

A warm standby region with replicated data and health-checked DNS that moves traffic when the primary fails.

Some outages take out a whole region. An active-passive design keeps a second region running at reduced scale with data replicated continuously. DNS records with health checks send users to the primary; when checks fail, DNS answers with the standby, which scales up to take the load. The key numbers are the recovery time objective (how long the switch takes) and the recovery point objective (how much data can be lost).

PRIMARY: US-WEST-2STANDBY: US-EAST-1primarysecondaryasync replicationRTDNS failoverhealth-checked recordsLBLoad balanceractiveAPPApp tier12 instancesDBDatabasewriterLBLoad balancerstandbyAPPApp tier2 instances (warm)DBDatabasereplica
traffictunnel / replicationblocked

When to use it

  • Services where a regional outage is unacceptable
  • Regulatory requirements for disaster recovery
  • Recovery time objectives measured in minutes

When to avoid it

  • Teams that cannot test failover regularly: an untested standby is not a standby

How traffic flows

  1. DNS health checks probe a deep health endpoint in the primary region every 10 seconds from several locations.
  2. The database replicates asynchronously to the standby region; replication lag sets the real recovery point.
  3. When the primary fails its checks, DNS answers with the standby. Low TTLs keep the switch to about a minute.
  4. Runbooks promote the replica to writer and scale the standby app tier to full size.

Configuration examples

resource "aws_route53_health_check" "primary" {
  fqdn              = "usw2.api.example.com"
  type              = "HTTPS"
  resource_path     = "/healthz/deep"
  request_interval  = 10
  failure_threshold = 3
  regions           = ["us-west-1", "us-east-1", "eu-west-1"]
}

resource "aws_route53_record" "api_primary" {
  zone_id         = aws_route53_zone.main.zone_id
  name            = "api.example.com"
  type            = "A"
  set_identifier  = "primary"
  health_check_id = aws_route53_health_check.primary.id
  failover_routing_policy { type = "PRIMARY" }
  alias {
    name                   = aws_lb.usw2.dns_name
    zone_id                = aws_lb.usw2.zone_id
    evaluate_target_health = true
  }
}

resource "aws_route53_record" "api_secondary" {
  zone_id        = aws_route53_zone.main.zone_id
  name           = "api.example.com"
  type           = "A"
  set_identifier = "secondary"
  failover_routing_policy { type = "SECONDARY" }
  alias {
    name                   = aws_lb.use1.dns_name
    zone_id                = aws_lb.use1.zone_id
    evaluate_target_health = true
  }
}

Examples are starting points. Review provider limits, names and versions for your environment before applying.

What to monitor

SignalWhy it matters
Replication lagThis is your actual recovery point, not the one in the design document.
Health check status from each probe locationDisagreement between probes points at a network problem, not the region.
Standby capacity and quotasA standby that cannot scale because of a quota limit fails at the worst moment.
Date of last failover testIf it is older than a quarter, the plan is a guess.

Common failure modes

Standby drifted from primary

Configuration changes were applied to one region only.

Sentinel compares both regions continuously and reports drift.

Quota limits in the standby region

Scaling to full size fails during the event.

Tune checks standby quotas against peak primary load each week.

Checklist

0 of 6 done
Was this pattern useful?

Run this pattern with NodeMethod watching it.

NodeMethod is onboarding early-access teams now. Tell us about your environment and we will be in touch.

esc
↑↓ to move↵ to open