RDS vs. Cloud SQL PostgreSQL: Disaster Recovery When a Region Fails
A cross-region replica can restore a PostgreSQL writer while still missing transactions that the original writer acknowledged. Recovery speed and data loss are different questions.
TL;DR
- Problem: Cross-region read replicas replicate asynchronously, so an abrupt regional outage can lose committed writes while manual promotion, DNS cutover, and unfenced writers extend recovery.
- Answer: Separate RPO (lag exposure) from RTO (promotion and routing), fence the old primary before opening the new writer, and use Cloud SQL Enterprise Plus managed write endpoints or automated RDS DNS cutover.
- Watch out: Planned switchover guarantees zero data loss only when both regions are healthy; never treat a switchover drill as proof of zero-loss outage recovery, and expect a 5–15 minute post-promotion PITR gap on Cloud SQL.
Situation
An enterprise can protect an Amazon RDS for PostgreSQL instance against an Availability Zone failure with Multi-AZ and still lose access to the database if the surrounding AWS region becomes unavailable. Adding a cross-region read replica establishes a recovery target in a second region, but it introduces an asynchronous replication boundary and a manual promotion workflow.
Google Cloud SQL Enterprise also supports cross-region read replicas. Cloud SQL Enterprise Plus adds an advanced disaster recovery workflow with a designated DR replica, a global managed DNS write endpoint, and a coordinated switchover operation. Both platforms serve the same broad goal—restoring a writable PostgreSQL primary in another region—but they do not make ordinary replica promotion, a planned switchover, and zonal HA failover interchangeable.
This is the second article in the PostgreSQL Across AWS and Google Cloud series. It covers Amazon RDS for PostgreSQL and Cloud SQL Enterprise and Enterprise Plus; Aurora Global Database and AlloyDB are outside its scope.
The Problem
A disaster recovery plan often declares that a cross-region replica is “ready to promote” without answering four operational questions: how much acknowledged data has actually reached the replica, who has authority and access to invoke promotion, how clients discover the new writer, and how the team fences the old region before rebuilding reverse replication. If the former primary returns while still accepting writes, directing clients to both databases creates divergent transaction histories that cannot be merged automatically.
Four concrete constraints govern cross-region PostgreSQL recovery:
- Asynchronous RPO math: Both RDS cross-region read replicas and Cloud SQL cross-region replicas replicate asynchronously over WAN links. At a sustained write rate of
2,000transactions per second, even15seconds of replication lag places2,000 × 15 = 30,000committed transactions at risk of loss during an abrupt regional failure. - Replica fan-out and backup retention limits: Amazon RDS PostgreSQL supports up to 15 read replicas per primary instance (or up to 155 using cascading replicas on PostgreSQL 14.1 and later), while native RDS automated backups and cross-region automated backup replication are capped at a maximum retention of 35 days. Retaining recovery points beyond 35 days requires manual snapshots or AWS Backup.
- No automatic cross-region promotion: Neither RDS cross-region read replicas nor Cloud SQL DR replicas promote automatically on a regional outage. Recovery requires an operator or external orchestrator to invoke promotion, reboot or reconfigure the replica into a standalone primary, and update client routing.
- Post-promotion PITR activation gap: On Cloud SQL Enterprise Plus Advanced DR, the newly promoted primary triggers an initial backup asynchronously after failover or switchover; Google documents that PITR becomes fully active only after that baseline backup completes, typically taking 5 to 15 minutes depending on disk size.
Backups solve a different problem than replicas. Automated backups and Point-in-Time Recovery (PITR) can recover from logical corruption or accidental deletion that has already replicated to a standby, but restoring from snapshots and replaying WAL into a new instance takes far longer than promoting a warm replica.
How should a team recover a regional PostgreSQL service while making the data-loss boundary and routing procedure explicit?
Options Considered
Cross-region PostgreSQL DR architectures trade idle compute cost, routing automation, and failback complexity against RTO and RPO targets. Single-region Multi-AZ is rejected as a regional DR strategy because both zones share the same regional control plane and fault domain.
| Option | RPO Exposure | Typical RTO Profile | Routing Mechanism | Failback Path | Why Chosen or Rejected |
|---|---|---|---|---|---|
| Cross-Region Backup Copy | Minutes (log shipping) | Slowest (full restore) | New instance endpoint | Restore to original region | Rejected for tight RTO; chosen only for low-cost cold DR or corruption recovery |
| RDS Cross-Region Read Replica | Async WAL lag | Manual promote + reboot | Route 53 CNAME or app config | Severed; must rebuild replica | Chosen on AWS RDS when warm standby RTO is required without Aurora |
| Cloud SQL Enterprise Replica | Async WAL lag | Manual promote | App config or custom DNS | Standalone; rebuild manually | Chosen on GCP Enterprise tier when Enterprise Plus cost is not justified |
| Cloud SQL Ent.+ Advanced DR | Async on outage; 0 on switchover | Managed failover/switchover | Managed .global.sql-psa.goog | Managed role reversal (switchover) | Chosen on GCP when managed DNS routing and planned zero-loss switchover matter |
The sharpest architectural split is between Cloud SQL Enterprise replica promotion and Enterprise Plus Advanced DR. Standard replica promotion on either RDS or Cloud SQL Enterprise severs the replication relationship permanently: once promoted, the replica becomes an independent primary, and returning to the original region requires provisioning a fresh replica in the recovered region and performing another cutover. Cloud SQL Enterprise Plus Advanced DR preserves the relationship metadata for planned switchovers and updates a global Private Services Access (PSA) DNS write endpoint automatically, removing manual connection-string edits at the cost of requiring the Enterprise Plus tier and PITR enabled on the primary.
Design the Recovery Path Before the Outage
A resilient cross-region design separates steady-state asynchronous replication from deliberate recovery invocation, endpoint routing, and post-recovery fencing. The schematic below outlines those boundaries; it does not imply automatic cross-region failover.
flowchart TD
A[Application — normal writes] --> B[Primary region — PostgreSQL writer]
B -->|asynchronous replication| C[Recovery region — replica]
D[Regional outage] --> E[Operator or orchestration invokes recovery]
E --> F[Replica becomes writer]
F --> G[Application reconnects through recovery routing]
H[Former region restored] --> I[Rebuild or reverse replication after verification]
Start with the asynchronous boundary
AWS describes RDS read replicas as asynchronous, and Cloud SQL cross-region replicas also replicate asynchronously. If a primary region fails after PostgreSQL acknowledges a commit to a client but before the WAL record reaches and is applied on the cross-region replica, promoting that replica drops those unshipped transactions. Consequently, RPO depends on the replica’s actual replay position at the instant of failure—not on a trailing dashboard average.
Recovery point objective (RPO) defines the maximum tolerable data loss; recovery time objective (RTO) defines the maximum tolerable time without a writable primary. Replica lag feeds directly into RPO exposure, while promotion duration, DNS propagation, and pool reconnection determine RTO. Measuring promotion time alone never proves either objective was met.
RDS: promote and re-establish routing
In Amazon RDS for PostgreSQL, promoting a cross-region read replica stops asynchronous replication from the source, reboots the replica to clear its read-only state, and converts it into a standalone read-write DB instance. Because the promoted instance gets its own RDS endpoint in the recovery region, the application must route through an abstraction—such as a Route 53 CNAME record with a low TTL or updated service discovery—to reach the new writer.
AWS recommends enabling automated backups on the cross-region read replica before an incident occurs so that post-promotion snapshots and PITR workflows operate immediately without building a baseline from scratch. Once the original region recovers, the old primary remains isolated; the team must provision a new replica in the original region from the promoted writer before planning any return migration.
Cloud SQL: distinguish promotion from advanced DR
Cloud SQL Enterprise and Enterprise Plus both support standard cross-region replica promotion. Enterprise Plus adds Advanced DR, which designates a cross-region replica as the DR target and exposes two distinct operations: replica failover for an unplanned regional outage and switchover for a planned, graceful role reversal.
Under documented prerequisites—including Enterprise Plus, PITR enabled on the primary, and compatible Private Services Access (PSA) networking—a planned switchover drains and synchronizes the DR replica for zero data loss before reversing roles. An unplanned replica failover does not provide that zero-loss guarantee because the primary region is unreachable and unshipped WAL cannot be fetched.
When configured with a managed DNS write endpoint (.global.sql-psa.goog over PSA), Cloud SQL automatically updates DNS to point to the newly promoted primary’s private IP after either failover or switchover. However, existing TCP sockets are still terminated, and SSL/TLS configurations must match between primary and DR replica or reconnecting clients will fail TLS handshakes.
# Promote a standalone RDS cross-region read replica during an AWS regional outage
aws rds promote-read-replica \
--db-instance-identifier orders-pg-dr-replica \
--region us-west-2
# Unplanned: fail over to the designated DR replica (immediate; data loss possible if the replica lags)
gcloud sql instances promote-replica orders-pg-dr-replica --failover
# Planned and lossless (also usable for DR tests): switchover
gcloud sql instances switchover orders-pg-dr-replica
Recovery is not finished at promotion
Promoting the DR replica restores write capability, not full production safety. Before opening the new writer to full traffic, verify instance sizing, security groups or VPC firewall rules, IAM/database credentials, monitoring alerts, and downstream CDC or analytics consumers. On Cloud SQL Advanced DR, confirm that the asynchronous post-promotion baseline backup has completed and PITR is active before declaring the environment fully protected against a second failure.
How It Rolls Out
A safe cross-region recovery follows four strict, ordered stages. Reordering them—especially allowing the old region to accept traffic before fencing—turns a regional outage into a data-corruption incident.
- Fence the old write path: Before promoting the recovery replica, block ingress traffic, disable background job workers, and revoke database routing in the failing primary region. If the primary region experiences a partial network partition rather than a total power-off, unfenced workers can continue writing to the old primary after the replica is promoted.
- Invoke replica promotion or failover: Execute
aws rds promote-read-replicaon RDS orgcloud sql instances failover(or switchover for planned tests) on Cloud SQL. Confirm the target instance transitions to read-write mode and check its latest applied transaction timestamp or sequence ID. - Cut over routing and verify parity: Update Route 53 CNAMEs on RDS or verify that the
.global.sql-psa.googwrite endpoint resolves to the recovery region on Cloud SQL. Validate TLS handshakes, connection-pool health, and—critically—confirm that automated backups and PITR are active on the new primary. - Reconcile and rebuild reverse replication: Compare an external durable audit log (such as an event bus, payment gateway log, or outbox ledger) against the promoted database to identify transactions committed in the lost region that never replicated. Once traffic is stable and the original region is healthy, provision a new cross-region replica back toward the original region before scheduling any failback.
Gate every production DR rollout with two separate drills: a planned switchover (or staged promotion) to validate permissions, DNS TTLs, and SSL parity, followed by an isolated failure-injection drill in a non-production environment that kills the primary under active write load to measure actual lost transactions.
In Practice
A rigorous DR exercise records evidence from both the database and an external observer outside the failure domain. Before starting an outage simulation, establish a continuous stream of sequentially numbered writes and log every acknowledged transaction ID to an independent store in a third region or neutral observability system.
During the drill, capture four timestamps and one sequence boundary: the last write acknowledged by the old primary, the highest sequence ID present on the promoted replica, the moment the new writer accepts its first TLS connection, and the moment a complete end-to-end business transaction succeeds. Subtracting the promoted sequence ID from the external acknowledgment log yields the exact RPO loss for that run, while the time gap establishes true application RTO.
Google’s documentation highlights why planned switchover drills cannot replace outage simulations: a Cloud SQL Advanced DR switchover coordinates both instances to achieve zero data loss, whereas an abrupt regional failure invokes replica failover against whatever WAL has already arrived. Similarly, on RDS, a manual promotion under zero load completes cleanly, whereas promoting under heavy write concurrency forces PostgreSQL crash recovery and WAL replay before connections open. Testing both scenarios under representative write load prevents false confidence in RPO and RTO numbers.
Where It Breaks
Cross-region disaster recovery fails most often in the seams between database promotion, network routing, and operational assumptions.
| Condition | Breaks How | Detect | Mitigate |
|---|---|---|---|
| Unfenced primary returns | Old region accepts writes after DR replica promotes, creating divergent histories | Conflicting sequence IDs or dual-region write metrics | Fence Region A ingress and workers before promotion |
| Async WAL lag at failure | Committed transactions in lost region are missing from promoted replica | Gap between external outbox log and promoted max ID | Alert on replication lag; reconcile missing events |
| SSL or network mismatch | Clients fail TLS or PSA routing when write endpoint flips to DR region | Spike in TLS handshake or connection refused errors | Audit SSL mode, CA certs, and VPC peering continuously |
| Post-promotion PITR gap | New primary lacks PITR during 5–15 minute initial backup window | Backup status shows baseline snapshot still in progress | Monitor backup completion before lifting load limits |
| Undersized DR replica | Smaller DR machine class saturates CPU or IOPS under production traffic | High CPU, lock waits, or connection timeouts post-cutover | Size DR replica for full production write and read load |
| Missing promotion permissions | On-call lacks IAM rights or CLI runbook to invoke failover | Promotion command fails with authorization error | Pre-stage break-glass IAM roles and test invocation quarterly |
| Switchover used as outage proxy | Team assumes zero data loss during unplanned outage based on switchover test | Unplanned outage loses recent writes despite “0 RPO” claim | Test abrupt primary kill under load separately from switchover |
| No reverse replication plan | Promoted region runs unprotected for days without a new DR replica | Single-region topology alert after DR event | Script reverse-replica creation immediately after stabilization |
Key Takeaways
- RPO and RTO are independent measurements: Async replica lag sets your data-loss boundary (RPO), while promotion, DNS cutover, and pool recovery set your downtime (RTO).
- Cross-region promotion is never automatic: Both RDS read replicas and Cloud SQL DR replicas require an explicit operator or orchestrator invocation to become writable.
- Fence before you promote: Allowing an old primary to accept traffic after a regional partition creates unmergeable split-brain histories.
- Managed write endpoints still require parity: Cloud SQL Enterprise Plus
.global.sql-psa.googendpoints automate DNS updates, but mismatched SSL configurations or missing PSA peering will still block clients. - Expect a post-promotion PITR window: Verify that the new primary’s baseline backup and PITR log archival are active before declaring recovery complete.
What to Do Next
- Problem: Document your service’s maximum acceptable lost transactions (RPO) and maximum acceptable writer outage (RTO) separately for a full regional failure.
- Solution: Choose between RDS cross-region read replicas, Cloud SQL Enterprise replicas, or Cloud SQL Enterprise Plus Advanced DR, and pair the choice with an explicit fencing and DNS routing design.
- Proof: Run a controlled recovery drill with sequentially numbered writes logged outside the primary region and reconcile the exact gap on the promoted instance.
- Action: Verify IAM promotion permissions, SSL/network parity, and backup retention settings across both regions, and assign explicit owners for promotion, reconciliation, and failback.