How it works
The explanation, with examples you can run.
Three kinds of copy
| Option | Replication | Serves reads? | Purpose |
|---|---|---|---|
| RDS Multi-AZ DB instance | Synchronous, one standby in another zone | No | Failover |
| RDS Multi-AZ DB cluster | Semisynchronous, two standbys in two other zones | Yes | Failover and reads, lower write latency |
| RDS read replica | Asynchronous, same or another Region | Yes | Read scaling, cross-Region copies |
| Aurora replica (up to 15) | Shared storage volume | Yes | Reads and failover targets |
With Multi-AZ, a write is not acknowledged until the standby has it, so a failover loses no committed data. On instance failure, a zone problem or some maintenance, RDS promotes the standby and updates the endpoint's DNS record. AWS quotes failover times of typically 60 to 120 seconds for a DB instance deployment (longer with large transactions to recover); DB clusters and Aurora are faster.
Aurora synchronously writes every change to six storage nodes spread across the Region's zones. Replicas read the same volume, so their lag is usually well under 100 milliseconds, and any replica can be promoted to writer; AWS says service is typically restored in under 60 seconds, often under 30. The storage volume grows automatically; you pay for storage used and I/O (or choose the I/O-Optimized configuration for I/O-heavy workloads). Aurora Serverless v2 scales capacity in small increments for variable load.
Making failover survivable
orders.cluster-abc123.eu-west-1.rds.amazonaws.com # writer endpointorders.cluster-ro-abc123.eu-west-1.rds.amazonaws.com # reader endpoint- Always connect through the endpoint names, never instance IPs, and do not cache DNS for longer than its TTL (some runtimes, such as older JVM settings, cache forever).
- Retry failed connections and idempotent queries with backoff. Transactions in flight at failover are rolled back.
- RDS Proxy pools connections, keeps client connections open during failover, and protects the database from connection storms from Lambda or autoscaling fleets.
- Test it: trigger a failover in staging (reboot with failover) and watch what your app does.
Other common failures
- Running out of connections when many small clients each open a pool. Every PostgreSQL connection costs memory; size
max_connectionsand pools together, or use a proxy. - Storage full: enable storage autoscaling on RDS, and alarm on free storage.
- Major-version upgrades are not automatic and need testing; blue/green deployments let you switch to an upgraded copy with a short cutover.
- Public accessibility: keep databases in private subnets with security groups that admit only the app tier.
- Backups you have never restored: automated backups and snapshots are only useful if a restore has been rehearsed and timed.
Cross-Region disaster recovery uses cross-Region read replicas, or Aurora Global Database, which replicates the storage volume to other Regions asynchronously.
Check yourself
3 questions. Get them all right to finish this topic.
0 of 3 right so far. Get all three to finish this topic.