Software Crafting

Enterprise Disaster Recovery: Architecting Active-Passive Multi-Region Failover for Kubernetes and PostgreSQL on AWS

DDeepak RajputCloud and DevOps14 min read06 Apr 2026Updated 2026-11-07
Two glowing server platforms, one cyan and one magenta, joined by streams of fiber optic light on a black background

TL;DR: Build an active-passive disaster recovery strategy on AWS using Amazon Aurora PostgreSQL Global Database, GitOps-driven EKS clusters in two regions, and Route 53 Application Recovery Controller (ARC). With warm compute in the secondary region, AWS documents RTO in the order of minutes and RPO typically measured in seconds, and a rehearsed runbook is what makes those numbers achievable in practice.

Key Takeaways

  • Use Amazon Aurora Global Database instead of standard cross-region read replicas; it replicates at the storage layer and AWS documents typical RPO in seconds.
  • Provision your multi-region topology using Terraform's aws_rds_global_cluster to link active (us-east-1) and passive (us-west-2) environments.
  • Maintain at least one DB instance in your secondary cluster. A headless secondary cannot be failed over to until you add an instance, which adds provisioning time to your RTO.
  • For unplanned outages, use the managed failover (aws rds failover-global-cluster --allow-data-loss) from the surviving region; detaching with remove-from-global-cluster is the manual fallback.

When a primary AWS region like us-east-1 degrades, your entire business is on the clock. Frameworks like SOC 2 and ISO/IEC 27001, along with many enterprise contracts, expect documented and tested business continuity and disaster recovery (DR) plans. They do not prescribe multi-region architecture, but a multi-region design is a common way to meet aggressive recovery targets.

Yet, when disaster actually strikes, the theoretical promises of a minimal Recovery Time Objective (RTO) and Recovery Point Objective (RPO) are rarely met. Restoring a multi-terabyte PostgreSQL database from a cross-region snapshot takes hours. Bootstrapping a fresh Elastic Kubernetes Service (EKS) cluster via Terraform during a regional outage takes time and depends on control-plane APIs that may themselves be degraded or busy. If you rely on long DNS TTLs and untested manual runbooks, traffic can keep flowing to the failed region and you risk split-brain writes.

To mitigate these risks, you need an Active-Passive Multi-Region architecture. In this guide, we will design a repeatable failover strategy using Amazon Aurora PostgreSQL Global Databases, GitOps-driven EKS clusters, and Route 53 Application Recovery Controller (ARC).

If you need help designing or rehearsing a plan like this, our DevOps and cloud deployment services cover multi-region AWS setups.

Reducing RPO with Aurora PostgreSQL Global Database

Standard RDS cross-region read replicas rely on PostgreSQL's native replication. Under heavy write loads, replication lag can grow, which increases your RPO. Promoting a read replica also involves a reboot and endpoint changes, which adds to your RTO.

Amazon Aurora Global Database replicates at the Aurora storage layer instead of shipping WAL through the database engine, which keeps the replication work off the primary's instances. Replication is still asynchronous: AWS documents RPO as typically measured in seconds, and for Aurora PostgreSQL you can set rds.global_db_rpo to cap it, at the cost of blocking commits when every secondary falls behind. Monitor the AuroraGlobalDBRPOLag CloudWatch metric to see your real lag.

Provisioning the Global Cluster Topology

Your active region (us-east-1) handles all read and write traffic. Your passive region (us-west-2) maintains a warm standby DB instance attached to the replicated storage volume.

# terraform/rds.tf

resource "aws_rds_global_cluster" "enterprise_global" {
  global_cluster_identifier = "enterprise-global-db"
  engine                    = "aurora-postgresql"
  engine_version            = "16.8" # pin a currently supported minor version
  database_name             = "app_production"
  storage_encrypted         = true
}

# Primary Cluster (us-east-1)
resource "aws_rds_cluster" "primary" {
  provider                    = aws.useast1 # Assumes aliased provider
  engine                      = aws_rds_global_cluster.enterprise_global.engine
  engine_version              = aws_rds_global_cluster.enterprise_global.engine_version
  cluster_identifier          = "enterprise-primary-cluster"
  global_cluster_identifier   = aws_rds_global_cluster.enterprise_global.id
  master_username             = "dbadmin"
  manage_master_user_password = true
  skip_final_snapshot         = false
}

# Secondary Cluster (us-west-2)
resource "aws_rds_cluster" "secondary" {
  provider                  = aws.uswest2 # Assumes aliased provider
  engine                    = aws_rds_global_cluster.enterprise_global.engine
  engine_version            = aws_rds_global_cluster.enterprise_global.engine_version
  cluster_identifier        = "enterprise-secondary-cluster"
  global_cluster_identifier = aws_rds_global_cluster.enterprise_global.id
  skip_final_snapshot       = true

  # Recommended by the provider docs for secondary clusters
  lifecycle {
    ignore_changes = [replication_source_identifier]
  }

  depends_on = [aws_rds_cluster.primary]
}

# Warm standby instance in the secondary cluster (a headless cluster cannot be failed over to)
resource "aws_rds_cluster_instance" "secondary_warm" {
  provider           = aws.uswest2
  identifier         = "enterprise-secondary-writer"
  cluster_identifier = aws_rds_cluster.secondary.id
  instance_class     = "db.r6g.large"
  engine             = aws_rds_cluster.secondary.engine
  engine_version     = aws_rds_cluster.secondary.engine_version
}

Production Note: Do not run your passive region completely "cold" (headless storage). AWS requires you to add a DB instance to a headless secondary cluster before you can fail over to it, so keep at least one instance (e.g., db.r6g.large) running there. Otherwise instance provisioning time is added to your database RTO. The primary cluster also needs its own aws_rds_cluster_instance resources, omitted here for brevity.

Executing an Unplanned Database Failover

During a regional failure, API calls to the primary region may time out, so initiate the failover from the healthy secondary region.

AWS offers two operations. A switchover (formerly "managed planned failover") waits for the secondary to catch up and loses no data, but it requires every cluster to be healthy. For an outage, use a failover with --allow-data-loss. Aurora promotes the secondary, attempts to fence writes on the old primary, snapshots the old volume so you can recover unreplicated transactions, and automatically re-adds the old region as a secondary when it recovers.

# Execute from the surviving region's CI/CD or operations bastion
aws rds failover-global-cluster \
    --region us-west-2 \
    --global-cluster-identifier enterprise-global-db \
    --target-db-cluster-identifier arn:aws:rds:us-west-2:123456789012:cluster:enterprise-secondary-cluster \
    --allow-data-loss

AWS documents that the chosen secondary typically assumes the primary role within a few minutes. If managed failover is not available (for example, the clusters run incompatible engine versions), the manual alternative is aws rds remove-from-global-cluster, which detaches the secondary and promotes it to a standalone cluster. After a detach you have to rebuild the global topology yourself, as shown in the failback section.

Point applications at the global writer endpoint rather than a regional cluster endpoint, and keep client DNS cache TTLs low, so connections follow the new primary without a config change.

Multi-Cluster EKS State Synchronization via GitOps

An active-passive architecture requires the passive EKS cluster to be running and identical in configuration to the active cluster. Attempting to apply Helm charts sequentially during a high-stress outage is a dangerous anti-pattern.

Instead, rely on GitOps tools like Argo CD or Flux. With Argo CD's ApplicationSet controller and cluster labels, the same Kubernetes manifests are continuously synced to both us-east-1 and us-west-2.

# argocd/applicationset.yaml
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: enterprise-workloads
  namespace: argocd
spec:
  generators:
    - clusters:
        selector:
          matchExpressions:
            - key: environment
              operator: In
              values: [production]
  template:
    metadata:
      name: '{{name}}-backend-api'
    spec:
      project: default
      source:
        repoURL: 'https://github.com/your-org/enterprise-manifests.git'
        targetRevision: HEAD
        path: workloads/backend-api
      destination:
        server: '{{server}}'
        namespace: production
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
        retry:
          limit: 5
          backoff:
            duration: 5s
            factor: 2
            maxDuration: 3m

Preventing Passive EKS from Consuming External APIs

Your passive cluster will be running identical pods, but those pods should not call external third-party APIs (like Stripe or Twilio) or consume queues. Doing so can cause duplicate processing and race conditions. Also note that the secondary Aurora cluster is read-only, so any writes from passive pods will fail.

To handle this, inject an environment variable such as CLUSTER_ROLE=passive into the secondary EKS cluster's workloads via a Kustomize overlay or a Helm value. Your application code must be context-aware:

// src/queue/worker.ts
export async function startWorker() {
  if (process.env.CLUSTER_ROLE === 'passive') {
    logger.info('Cluster is passive. SQS consumer disabled.');
    return; // Exit without polling
  }

  // Initialize standard active queue polling
  const consumer = Consumer.create({
    queueUrl: process.env.SQS_QUEUE_URL,
    handleMessage: async (message) => {
      await processTransaction(message);
    },
  });

  consumer.start();
}

Deterministic Failover with Route 53 Application Recovery Controller (ARC)

Purely automatic Route 53 health-check failover is risky for an active-passive database design. If a health check fails briefly, DNS might route traffic to your passive region before the database is promoted, producing a surge of write errors. DNS TTL caching also means some clients follow the change late.

Instead, use Amazon Application Recovery Controller (ARC) routing controls. Routing control state is stored in a cluster with five regional endpoints, and AWS states that at least three of them are always accessible for state changes. Traffic only moves when an authorized operator or automation changes the state, which avoids the "flapping" (traffic bouncing between regions) that automatic health checks can cause. Each routing control is attached to a Route 53 health check, and your DNS failover records reference those health checks; those resources are omitted below for brevity.

First, provision the ARC Routing Controls:

# terraform/arc.tf
resource "aws_route53recoverycontrolconfig_cluster" "dr_cluster" {
  name = "enterprise-dr-cluster"
}

resource "aws_route53recoverycontrolconfig_control_panel" "dr_panel" {
  name        = "enterprise-control-panel"
  cluster_arn = aws_route53recoverycontrolconfig_cluster.dr_cluster.arn
}

resource "aws_route53recoverycontrolconfig_routing_control" "active_east" {
  name              = "route-us-east-1"
  control_panel_arn = aws_route53recoverycontrolconfig_control_panel.dr_panel.arn
}

resource "aws_route53recoverycontrolconfig_routing_control" "passive_west" {
  name              = "route-us-west-2"
  control_panel_arn = aws_route53recoverycontrolconfig_control_panel.dr_panel.arn
}

When a DR event is declared, an authorized engineer or an automated workflow updates the routing control state through the ARC data plane API.

Warning: The ARC data plane uses cluster-specific regional endpoints. Retrieve them with DescribeCluster ahead of time and try each endpoint in rotation, because AWS cycles endpoints through maintenance. The route53-recovery-control-config client is for configuration only and cannot change routing control states.

import boto3
import time

# Cluster endpoints from DescribeCluster, cached ahead of time (e.g. in SSM Parameter Store)
ENDPOINTS = [
    ("https://host-xxx.us-west-2.a.routing-control.amazonaws.com/v1", "us-west-2"),
    ("https://host-yyy.eu-west-1.a.routing-control.amazonaws.com/v1", "eu-west-1"),
    ("https://host-zzz.ap-northeast-1.a.routing-control.amazonaws.com/v1", "ap-northeast-1"),
]

WEST_ARN = "arn:aws:route53-recovery-control::123456789012:controlpanel/xxx/routingcontrol/passive_west"
EAST_ARN = "arn:aws:route53-recovery-control::123456789012:controlpanel/xxx/routingcontrol/active_east"

def execute_traffic_failover():
    last_error = None
    for endpoint_url, region in ENDPOINTS:
        try:
            # The 'route53-recovery-cluster' client is the data plane for state changes
            client = boto3.client(
                "route53-recovery-cluster", endpoint_url=endpoint_url, region_name=region
            )
            # Update both controls in one call so safety rules evaluate the final state
            client.update_routing_control_states(
                UpdateRoutingControlStateEntries=[
                    {"RoutingControlArn": WEST_ARN, "RoutingControlState": "On"},
                    {"RoutingControlArn": EAST_ARN, "RoutingControlState": "Off"},
                ]
            )
            print(f"Traffic shifted to us-west-2 via {region}")
            return
        except Exception as error:  # try the next endpoint
            print(f"Endpoint {region} failed: {error}")
            last_error = error
            time.sleep(1)
    raise RuntimeError("All ARC cluster endpoints failed") from last_error

if __name__ == "__main__":
    execute_traffic_failover()

Managing Cross-Region Persistent Data and Backups

Stateless microservices are easily replicated. Database state is handled by Aurora. But what about EKS stateful workloads, persistent volumes (EBS), or dynamically generated static assets (S3)?

For Amazon S3, enable Cross-Region Replication (CRR) on your critical buckets for asynchronous object replication. If you need a predictable replication time, S3 Replication Time Control adds an SLA-backed target.

For persistent volumes attached to EKS, you must orchestrate EBS snapshot replication using AWS Backup.

# terraform/aws_backup.tf
resource "aws_backup_plan" "cross_region_dr" {
  name = "eks-pv-dr-plan"

  rule {
    rule_name         = "hourly-cross-region"
    target_vault_name = aws_backup_vault.primary.name
    schedule          = "cron(0 * * * ? *)" # Runs hourly

    lifecycle {
      delete_after = 7
    }

    copy_action {
      destination_vault_arn = aws_backup_vault.secondary.arn
      lifecycle {
        delete_after = 7
      }
    }
  }
}

If your RPO for persistent volumes must be less than an hour, hourly EBS snapshots are insufficient. One option is to move file storage to Amazon EFS and use EFS replication to a secondary region; check the current AWS documentation for its RPO target, which is measured in minutes rather than seconds. Alternatively, use an open-source tool like VolSync in your Kubernetes clusters to replicate PersistentVolumeClaims asynchronously (it supports rsync-based and other movers).

Executing the Failover Sequence

A disaster recovery plan is of little use if it depends on fragmented, untested scripts. The sequence of operations should be scripted, safe to re-run, and orchestrated by a system outside of the failing region (e.g., GitHub Actions, a multi-region Jenkins instance, or AWS Step Functions in a neutral third region).

The strict operational sequence is:

  1. Fence the Primary Region: Stop application writes to the primary region (scale down writers or take the app offline there) to reduce split-brain risk if the region is only partially degraded. Aurora's own write fencing during failover is best effort.
  2. Promote the Database: Run the managed failover to promote the us-west-2 cluster.
  3. Reconfigure EKS Applications: Patch the passive EKS cluster to transition CLUSTER_ROLE to active, enabling background jobs and external API integrations.
  4. Shift Global Traffic: Use ARC routing controls to shift ingress traffic to us-west-2.

Here is a conceptual break-glass orchestrator script executing the failover:

#!/bin/bash
set -euo pipefail

echo "INITIATING DR FAILOVER"

# Step 1 (fencing application writes in us-east-1) is assumed done before this script runs.

# Step 2: Promote DB
echo "1. Promoting Aurora cluster in us-west-2..."
aws rds failover-global-cluster \
    --region us-west-2 \
    --global-cluster-identifier enterprise-global-db \
    --target-db-cluster-identifier arn:aws:rds:us-west-2:123456789012:cluster:enterprise-secondary-cluster \
    --allow-data-loss

echo "Waiting for promotion to complete..."
aws rds wait db-cluster-available \
    --region us-west-2 \
    --db-cluster-identifier enterprise-secondary-cluster

# Step 3: Patch EKS ConfigMap
# Note: In a mature GitOps flow, this is triggered via a configuration repo PR.
echo "2. Activating EKS Workers in us-west-2..."
aws eks update-kubeconfig --region us-west-2 --name enterprise-eks-west
kubectl patch configmap app-config -n production \
  -p '{"data":{"CLUSTER_ROLE":"active"}}'
kubectl rollout restart deployment/backend-api -n production

# Step 4: Shift ARC Traffic
echo "3. Flipping Route 53 ARC..."
python3 arc_failover.py

echo "FAILOVER COMPLETE. us-west-2 is now ACTIVE."

The Failback Sequence: Re-establishing Topology

A frequently overlooked part of disaster recovery is the failback. Once the us-east-1 outage is resolved, you cannot simply flip routing back, because the old primary is behind the new one.

If you used the managed failover above, Aurora re-adds us-east-1 as a secondary automatically once the region is healthy, after snapshotting the old volume (named rds:unplanned-global-failover-...) so you can recover any unreplicated transactions. When it has caught up, use a switchover to move the primary back with no data loss:

aws rds switchover-global-cluster \
    --region us-west-2 \
    --global-cluster-identifier enterprise-global-db \
    --target-db-cluster-identifier arn:aws:rds:us-east-1:123456789012:cluster:enterprise-primary-cluster

If you used the manual detach instead, the promoted us-west-2 cluster is no longer part of any global database, so you rebuild the topology around it:

  1. Snapshot the active database: Take a backup of the newly promoted primary in us-west-2.
  2. Retire the old primary: After recovering anything you need from it, delete the stale cluster in us-east-1 (and the old global cluster).
  3. Re-establish the global cluster: Create a new global cluster from the us-west-2 cluster and add us-east-1 back as a secondary region, which triggers a full data copy.
# Create a new global cluster with the promoted us-west-2 cluster as its primary
aws rds create-global-cluster \
    --region us-west-2 \
    --global-cluster-identifier enterprise-global-db-v2 \
    --source-db-cluster-identifier arn:aws:rds:us-west-2:123456789012:cluster:enterprise-secondary-cluster

# Add us-east-1 back as a secondary (then add a DB instance to it)
aws rds create-db-cluster \
    --region us-east-1 \
    --db-cluster-identifier enterprise-primary-cluster-new \
    --global-cluster-identifier enterprise-global-db-v2 \
    --engine aurora-postgresql \
    --engine-version 16.8

Only after the storage has fully synced to us-east-1 (which can take hours depending on volume size) and replication lag is low can you safely run a switchover back to us-east-1 and revert your EKS cluster roles.

By keeping both EKS clusters in sync through GitOps, using Aurora Global Database for storage-level replication, and moving traffic with explicit ARC routing controls, you can recover from a regional outage within minutes and lose at most the few seconds of writes that had not replicated. Rehearse the full failover and failback regularly; untested runbooks are where most DR plans fail.

Sources

Available for Work

Need help building this in production?

SoftwareCrafting is a full-stack dev agency - we ship fast, scalable React, Next.js, Node.js, React Native & Flutter apps for global clients.

Get a Free Consultation

Frequently Asked Questions

Why use Amazon Aurora Global Database instead of standard PostgreSQL cross-region read replicas?

Standard read replicas rely on PostgreSQL replication through the database engine, which can lag under heavy write loads and increase your Recovery Point Objective (RPO). Aurora Global Database replicates at the storage layer, AWS documents a typical RPO measured in seconds, and it supports managed failover and switchover operations that preserve the global topology.

Should the passive region database run completely cold to save AWS costs?

Not if you need a short RTO. AWS requires you to add a DB instance to a headless secondary cluster before you can fail over to it, so instance provisioning time is added to your Recovery Time Objective (RTO). A single warm instance, such as a db.r6g.large, avoids that delay.

How do you execute an unplanned PostgreSQL failover if the primary AWS region is completely down?

If the primary region's control plane is unresponsive, you must initiate the failover directly from the healthy secondary region. Use aws rds failover-global-cluster --allow-data-loss in the secondary region. Aurora promotes the secondary, attempts to fence writes on the old primary, and re-adds the old region as a secondary when it recovers. If managed failover is not available, aws rds remove-from-global-cluster detaches and promotes the secondary manually.

Why is bootstrapping a fresh EKS cluster via Terraform a bad strategy during a regional outage?

Provisioning a new EKS cluster, node groups and add-ons from scratch takes a significant amount of time even on a good day, and during a regional event many customers may be calling the same APIs in the surviving regions. To keep RTO short, maintain a pre-provisioned, GitOps-driven EKS cluster in your passive region.

About the author

Deepak Rajput

Founder and CEO of SoftwareCrafting

Deepak Rajput is the Founder and CEO of SoftwareCrafting in Delhi and writes about web, mobile, backend, cloud, security, and engineering leadership.

Writes about Next.js, Node.js, React Native, PostgreSQL, AWS, Kubernetes.

View author profile

Last updated: 2026-11-07