Sub topic 5
Replicating data across Regions
This chapter assumes you know Regions, RDS, Aurora, DynamoDB, and S3 at a basic level, and can read AWS CLI commands. Backups copy data on a schedule. Replication copies changes continuously, so the recovery point objective (RPO) shrinks from hours to seconds. Pilot light, warm standby, and active/active all depend on it.
Asynchronous replication and RPO
Cross-Region replication on AWS is asynchronous. The primary Region acknowledges a write before the copy reaches the second Region. The delay between the two is replication lag, and your worst-case data loss at failover is roughly the lag at the moment of failure. Monitor lag as a metric and alarm on it, because it is your real RPO.
Choosing a mechanism
Each service has its own feature. Pick by service and by the RPO you set.
| Service | Mechanism | Typical lag | Writable in DR Region? |
|---|---|---|---|
| Aurora | Global database | Usually under 1 second | No, until you fail over |
| RDS (MySQL, PostgreSQL, MariaDB) | Cross-Region read replica | Seconds to minutes, depends on load | No, until you promote it |
| DynamoDB | Global tables | Usually about a second | Yes, in every replica |
| S3 | Cross-Region replication (CRR) | Minutes by default | Yes, but it is a separate bucket |
Databases
Aurora global database replicates at the storage layer, so it adds little load to the writer. The secondary cluster is read-only. During a Regional outage you promote it, which takes about a minute. For a planned move, use switchover, which waits for the secondary to catch up and loses no data:
aws rds failover-global-cluster \
--region us-west-2 \
--global-cluster-identifier app-global \
--target-db-cluster-identifier arn:aws:rds:us-west-2:111122223333:cluster:app-dr-clusterA cross-Region RDS read replica uses the engine's native replication, so lag grows with write volume. Promoting it breaks the replication link permanently, and you must create a new replica to fail back.
DynamoDB global tables are multi-writer. Concurrent writes to the same item resolve by last writer wins, so design the application to avoid conflicting writes from two Regions.
Object storage
S3 CRR needs versioning enabled on both buckets and an IAM role that S3 can assume. By default it copies only objects written after the rule exists. Existing objects need S3 Batch Replication. Delete markers are not replicated unless you opt in. S3 Replication Time Control adds a 15-minute service-level agreement for 99.99 percent of objects, which you need if your RPO is tight.
Common errors
- Replication is not a backup. A bad deployment or a deleted table replicates to the DR Region within seconds. Keep point-in-time recovery or backups as well.
- Ignoring lag. Without an alarm, you learn your real RPO only during the disaster.
- Forgetting dependencies. Secrets, parameters, KMS keys, and AMIs are Regional. Replicate or recreate them in the DR Region, and use a KMS key that exists there for encrypted replicas.
- Assuming the DR copy is writable. Aurora secondaries and RDS replicas reject writes until promoted.
Exercise
Your RPO is 5 seconds. A team proposes a cross-Region RDS PostgreSQL read replica, and the workload has heavy, bursty writes. What is the risk, and what would you change or check?
Show answer
Read replica lag grows with write volume, so during bursts it can exceed 5 seconds, and the lag at failure time is your data loss. Alarm on replica lag and test it under peak load. If it exceeds the target, move to Aurora global database (typically under 1 second of lag) or DynamoDB global tables, depending on the data model.