RDS High Availability, Replicas and Disaster Recovery
Overview
Databases are usually the hardest tier to make highly available. Amazon RDS gives you two different tools that are often confused: Multi-AZ for availability and durability and read replicas for read scaling (and, cross-Region, for disaster recovery).
Multi-AZ is like having a trained understudy standing in the wings of the stage, receiving every line in sync; if the lead collapses the understudy steps in immediately. A read replica is more like a colleague who photocopies the script regularly so extra people can read it, but who might be a few pages behind.
The exam expects you to pick the correct mechanism, know failover behaviour, and apply DR strategies (backup & restore, pilot light, warm standby, multi-site) that match the stated RTO and RPO.
Key Concepts
- Multi-AZ instance deployment: synchronous standby in another AZ; automatic failover (typically 60-120 s) by flipping the DNS endpoint. The standby cannot serve reads.
- Multi-AZ DB cluster (MySQL/PostgreSQL): two readable standbys, faster failover (~35 s or less), semi-synchronous commits.
- Read replicas use asynchronous replication, can be in another Region, can be promoted, and have their own endpoint; replica lag shows in ReplicaLag.
- Aurora stores six copies across three AZs; up to 15 replicas share storage; failover usually under 30 s; Aurora Global Database replicates cross-Region with typical lag under 1 s.
- Automated backups give PITR (1-35 days) using transaction logs; manual snapshots persist until deleted.
- RDS Proxy pools connections and shortens failover impact for Lambda/bursty apps.
- DR strategies in increasing cost: backup & restore, pilot light, warm standby, multi-site active-active.
- Maintenance and failover events appear in RDS events and can notify via SNS.
Detailed Notes
Multi-AZ vs read replica
| Aspect | Multi-AZ | Read replica |
|---|---|---|
| Purpose | HA / durability | Read scaling, cross-Region DR |
| Replication | Synchronous | Asynchronous |
| Failover | Automatic | Manual promotion (or Aurora auto) |
| Readable | No (instance) / yes (cluster) | Yes |
| Endpoint | Same endpoint, DNS flips | Separate endpoint |
| Cross-Region | No | Yes |
What triggers a Multi-AZ failover
Primary host or AZ failure, instance type change, OS patching, storage failure, manual reboot with failover. Test it:
aws rds reboot-db-instance --db-instance-identifier prod-db --force-failover
aws rds describe-events --source-type db-instance --source-identifier prod-db --duration 60
Applications must reconnect and honour DNS TTL; avoid caching the IP address. RDS Proxy keeps connections and reduces failover time.
Creating and promoting replicas
aws rds create-db-instance-read-replica --db-instance-identifier prod-db-eu \
--source-db-instance-identifier arn:aws:rds:us-east-1:111122223333:db:prod-db \
--source-region us-east-1 --region eu-west-1 --kms-key-id alias/rds-eu
aws rds promote-read-replica --db-instance-identifier prod-db-eu
Promotion breaks replication permanently; the promoted instance becomes a standalone writable DB.
Monitor replica health
| Metric | Meaning |
|---|---|
ReplicaLag | Seconds behind source; alarm above RPO |
DatabaseConnections | Saturation |
FreeStorageSpace | Running out of disk triggers outage |
BinLogDiskUsage | Pending logs for replicas |
aws cloudwatch put-metric-alarm --alarm-name replica-lag --namespace AWS/RDS --metric-name ReplicaLag \
--dimensions Name=DBInstanceIdentifier,Value=prod-db-eu --statistic Average --period 60 \
--evaluation-periods 5 --threshold 30 --comparison-operator GreaterThanThreshold \
--alarm-actions arn:aws:sns:eu-west-1:111122223333:db-alerts
Backups and PITR
aws rds restore-db-instance-to-point-in-time --source-db-instance-identifier prod-db \
--target-db-instance-identifier prod-db-restore --restore-time 2025-03-01T10:15:00Z
Automated backups are deleted with the instance unless you keep them (retained automated backups) or take a final snapshot. Cross-Region copy of snapshots or automated backup replication supports DR.
DR strategies
| Strategy | RTO / RPO | Description | Cost |
|---|---|---|---|
| Backup & restore | Hours / hours | Restore from backups in DR Region | $ |
| Pilot light | Tens of minutes | Core data replicated; compute off until needed | $$ |
| Warm standby | Minutes | Scaled-down full environment running | $$$ |
| Multi-site active-active | Near zero | Full capacity in multiple Regions | $$$$ |
For RDS: cross-Region read replica = pilot light/warm standby; Aurora Global Database = RPO ~ seconds, RTO ~ minute with managed failover/switchover.
Operations pitfalls
- Failover causes brief outage; use retry logic.
- Replica of a Multi-AZ source is not itself Multi-AZ unless configured.
- Storage auto scaling prevents
FreeStorageSpaceoutages; set a max.### DR strategies compared and failover mechanics
| Strategy | RTO / RPO | Cost | Description |
|---|---|---|---|
| Backup and restore | Hours / hours | Lowest | Copy backups to another Region, rebuild with IaC |
| Pilot light | Tens of minutes / minutes | Low | Core data replicated, compute off until needed |
| Warm standby | Minutes / seconds | Medium | Scaled-down full stack running |
| Multi-site active-active | Near zero / near zero | Highest | Full capacity in several Regions |
| Database option | Failover behaviour |
|---|---|
| RDS Multi-AZ instance | Synchronous standby, automatic failover typically 60-120 s, DNS endpoint flips |
| RDS Multi-AZ cluster | Two readable standbys, faster failover, semi-synchronous |
| Aurora | Shared storage, replica promoted in about 30 s or less; Global Database for cross-Region with RPO of about 1 s |
| Read replica | Asynchronous, used for scaling reads or manual DR promotion |
aws rds reboot-db-instance --db-instance-identifier prod-db --force-failover
aws rds promote-read-replica --db-instance-identifier prod-db-replica-eu
aws rds describe-events --source-type db-instance --duration 120
Multi-AZ is for availability, replicas are for scaling; a Multi-AZ standby cannot serve reads (instance deployment). Use ForceFailover reboots to test failover during game days, and always connect through the DNS endpoint, never an IP.
Real World Example
Scenario โ meeting a 5-minute RTO. An online broker uses Aurora PostgreSQL with a writer and two replicas across three AZs, fronted by RDS Proxy. An AZ failure promotes a replica within seconds; the application reconnects through the proxy with no code changes.
For regional disaster they run an Aurora Global Database with a secondary cluster in another Region and a warm-standby application stack. A runbook, rehearsed quarterly, uses managed failover and flips Route 53 records through ARC. CloudWatch alarms on AuroraGlobalDBReplicationLag ensure RPO stays within seconds.
Architecture Diagram
- 1The application writes to the primary instance.
- 2Writes replicate synchronously to the Multi-AZ standby for local HA.
- 3Changes replicate asynchronously to a replica in the DR Region.
- 4In a disaster the replica is promoted and DNS shifts traffic.
Best Practices
- โRun production on Multi-AZ (or Aurora) and test failover with a forced reboot.
- โAlarm on ReplicaLag, FreeStorageSpace, CPU and connections.
- โUse RDS Proxy for bursty or serverless clients and keep DNS TTL handling correct.
- โDocument RTO/RPO per tier and choose the cheapest DR strategy that meets them.
- โEncrypt, keep retained automated backups / final snapshots, and copy backups cross-Region.
Common Interview Questions
Exam Tips
SOA-C03 focus
- High availability within a Region -> Multi-AZ. Read scaling or cross-Region DR -> read replica.
- Multi-AZ replication is synchronous; read replicas asynchronous.
- Recover from logical errors -> PITR / snapshot (Multi-AZ cannot).
- Fastest cross-Region DB DR with seconds RPO -> Aurora Global Database.
Chapter quiz
Reliability and Business Continuity ยท 10 questions
1.An Auto Scaling group behind an ALB keeps replacing instances that are actually running, because the application takes four minutes to start. What is the BEST fix?
2.A company wants DNS to send users to a standby site when the primary web site stops responding. Which Route 53 configuration meets this?
3.Which AWS Backup feature prevents even privileged users from deleting recovery points before retention expires?
4.An RDS MySQL database needs a Regional-failure recovery plan with minutes of RPO and the lowest cost that keeps data continuously replicated. What should be used?
5.A Route 53 health check must monitor an application running on private IP addresses inside a VPC. Which approach works?
6.An Auto Scaling group must run a script that drains connections and uploads logs before an instance is terminated during scale-in. What should be configured?
7.Traffic follows a predictable daily cycle and new instances take 4 minutes to become ready. How can capacity be ready before the spike?
8.A Route 53 failover health check must monitor an application in a private subnet that the public health checkers cannot reach. What is the correct approach?
9.A compliance team needs backups that cannot be deleted by any user, including administrators, for 7 years. Which AWS Backup feature fits?
10.An application can tolerate a few minutes of downtime and about 1 second of data loss across Regions, at moderate cost. Which database and DR design fits best?
0 of 10 answered
Finished this lesson?
0 of 46 lessons done ยท 0% of the course

