Plan regional recovery for a single-region service
In brief
Rehearse a full restore outside the primary region. Consider a warm standby if restoration can't meet the recovery time or data-loss target.
- Verify that backups, release artifacts, and credentials survive the outage.
- Fence old writers and reconcile outstanding work before the replacement accepts traffic.
A service can fit in one region while its recovery plan needs resources outside it.
For a small Cloud Run application with PostgreSQL and queued work, we’d start with recoverable inputs and a rehearsed restoration sequence. Pay for a warm standby only when that sequence can’t meet the outage or data-loss window the business accepts.
That choice requires two numbers. The recovery time objective is how long the service may be unavailable. The recovery point objective is how much committed history may be lost.
Write them against a specific failure: the primary region is unavailable, including its application, database, and queue access. A successful restart after a bad deployment doesn’t test that assumption.
Map the inputs needed to recover
Start with the production release you can restore, and record its image digest, configuration version, and compatible database schema. Keep the recovery instructions and access procedure somewhere the failed region doesn’t have to serve.
| Input | What the recovery plan must confirm |
|---|---|
| Database | Recoverable data age, supported target region, usable backup or replica, required keys and restore identity |
| Image and configuration | Exact deployable release available without rebuilding through the failed region |
| Secrets and identity | Existing secret versions readable by the recovery runtime; operator and service identities authorized |
| Network | Target subnet, database reachability, egress address and any supplier allowlist prepared |
| Work records | Accepted operations and completion receipts recoverable to a known point; delivery queue can be replaced |
| Entry route | Domain, certificate, load-balancer or DNS procedure, and callers that bypass the public route |
Give each row an owner, a retrieval procedure, and a rehearsal result. If database schedules or subscriptions can send effects when an instance starts, isolate them before restoring it. An infrastructure definition says what should exist. Someone still has to produce the lost image, decrypt the backup, and show that an incident operator can create the replacement.
Artifact Registry supports regional and multi-regional repositories. Choose an image availability strategy, such as a verified digest copy in the recovery region. Check the runtime can fetch it there.
Don’t make an emergency deployment depend on a fresh build that reads source, credentials, or packages through the failed region.
For secrets, reading an existing version during recovery is a different problem from changing one. Secret Manager’s replication policies differ by location. With user-managed replication, an unavailable configured location can prevent creating or updating a secret even when another replica is available. Prepare the required versions and access paths in advance. An untested rotation step can add a new outage dependency.
Decide which database state can survive
Cloud SQL high availability only handles failures within a region.
Restoring a backup and promoting a cross-region replica are different recovery paths. The replica gives you a running copy sooner, but asynchronous replication leaves a potential loss window.
For restoration, verify the backup policy, location, age, and encryption dependencies. Cloud SQL supports backup restore into another region, so pick that path and rehearse it. Don’t substitute a familiar PITR command without checking its restrictions: the documented backup-vault PITR procedure requires the target to use the source instance’s region.
Suppose the region fails at 14:00 and the latest usable backup represents 13:25. Up to 35 minutes of committed work may be absent from the recovered database, including accepted jobs, completion receipts, and customer changes. Reconstructing a queue from database records can’t recover records missing from the backup. Identify an independent reconciliation source, or accept the loss and record that decision.
A cross-region replica changes this calculation. Check the replica promotion procedure for the chosen edition and DR configuration. A replica that has replayed everything it received can still be missing commits the failed primary never transmitted.
Ordinary replica promotion and the managed DR workflow also differ in how they handle the former primary and a later return. Choose one procedure before the incident and follow its promotion and return sequence.
Calculate the complete recovery sequence
Restoring the database is only one step. Here’s an example plan with invented durations:
| Step | Minutes | Starts after |
|---|---|---|
| Detect and declare regional recovery | 10 | Outage |
| Confirm that former writers can’t act | 25 | Declaration |
| Prepare target access, network, and recovery inputs | 20 | Declaration |
| Restore database | 50 | Target inputs ready |
| Deploy compatible application with external effects disabled | 10 | Database restored |
| Validate data and controlled application operations | 15 | Deployment and writer fencing complete |
| Change route and verify caller behavior | 5 | Validation |
The critical path takes 110 minutes. Fencing runs alongside target preparation and restoration, so adding every duration would overstate this particular plan. If fencing instead takes 130 minutes after declaration, recovery takes 160 minutes: validation must wait for it even though the application is ready sooner.
A two-hour target leaves only ten minutes of margin in the first case. Operator availability, quota problems, resource provisioning, and restore variance can use that up quickly. Measure the complete sequence at representative data volume and record slow runs. Giving an untimed step zero minutes makes the spreadsheet reassuring and the plan unusable.
If the target is one hour, improve the steps that dominate or maintain a warm standby. A precreated network and runtime may remove some setup, while a cross-region database replica removes a full restore from the normal failover path. Both cost money and recurring rehearsal effort. They still leave validation, potential data loss, and write authority to deal with.
Fence the old system before enabling the new one
A region can be unreachable from the operator while some workloads still run. Removing its public route won’t necessarily stop private clients, scheduled work, database sessions, or an external provider call already in flight.
Define the evidence that allows the new system to write. It may come from the chosen provider-managed DR workflow or from a separately designed fencing authority that stays available during the regional failure. The procedure must cover every writer, including workers that can act without receiving fresh requests.
A flag in the newly restored database can’t fence a worker connected to the old database. Each copy can authorize its own worker. Changing a password may also leave an already authenticated session running. Test the fence with an old connection and a delayed worker still alive. After fencing, neither should be able to commit or start another protected effect.
If that evidence isn’t available, keep the replacement’s writes and external effects disabled. Prepare and inspect it while authority is being resolved.
When the required recovery time can’t tolerate that uncertainty, the system needs a stronger DR design before the incident.
Treat external effects separately. A payment or supplier request might have succeeded after the last replicated receipt. Keep stable operation identifiers and query or reconcile the external result before repeating uncertain work.
Restore delivery and routing
Cloud Tasks queues are created in a specified location. A queue in the recovery region is a different resource, and deploying a worker there doesn’t move the original backlog into it.
Use recoverable operation records to reconstruct delivery where that’s the application’s contract. Carry forward operation identities, recheck whether each action is still allowed, limit dispatch while validating the new database, and keep uncertain outcomes for reconciliation. When the old queue becomes reachable again, its delayed deliveries must meet the same authority checks instead of executing against an abandoned database.
For HTTP traffic, the basic global load-balancer setup in Cloud Run’s multi-region deployment guide doesn’t automatically move requests away from an unresponsive regional service. Configure and test failure detection instead of assuming that two backends provide it.
Cloud Run service health can support automated regional routing using readiness results, with prerequisites including minimum instances in each participating region. That signal covers service health only. Promoting PostgreSQL, reconstructing work, and resolving conflicting writers stay in the recovery procedure. Keep the new region unready for normal writes until the recovery decision allows them.
Check machine callers as well as the browser route. Fixed regional URLs, token audiences, callbacks, and supplier allowlists can keep using the original location after the public hostname works. Record which addresses change and which callers must be updated.
Rehearse the regional failure boundary
In an authorized nonproduction exercise, deny the recovery team and replacement runtime access to the primary region’s dependencies. Recover the selected release using only the documented inputs. Include an operation accepted just before the recovery point, one committed after it, and an external effect whose local receipt is missing. The results should show exactly which state survives and which needs reconciliation.
Measure from the first observable failure through validated user operations. Keep old workers and delayed deliveries in the exercise long enough to challenge fencing. Then restore the old region’s availability and verify that it can’t resume authority by itself.
Once the replacement has accepted writes, a return to the original region is another state migration. Set up replication again or rebuild the former primary from the chosen authority, verify protection and backups, and plan the return.
Repointing clients to the old database would discard the history created during recovery.
More in this domain: Operations
Browse allKeep BigQuery federation from overloading PostgreSQL
Use BigQuery federation for narrow, occasional PostgreSQL reads. Move repeated historical reporting to an analytical copy.
Allocate shared BigQuery reservation costs without inventing query prices
Charge purchased BigQuery capacity to the teams that requested it. Divide agreed shared costs by measured usage.
Cloud SQL vs. AlloyDB for PostgreSQL: what earns the migration
Start with Cloud SQL for a modest PostgreSQL application. Test AlloyDB when its read scaling, storage, or columnar engine addresses a measured need.
An alert is not a notification
Send a notification when awareness is enough. Create an operational alert when someone owns a decision.
Why alert feedback should be structured first
Collect a structured response first and leave room for an optional note.
Related patterns
Why Cloud Run + Postgres needs a connection budget
Budget PostgreSQL connections across the whole Cloud Run fleet.
Managed connection pooling in Cloud SQL: when it helps and when it complicates things
Try Cloud SQL managed pooling when connection bursts exhaust sessions while PostgreSQL still has capacity to do the work.
How we decide between Cloud SQL connectors, Auth Proxy, and private IP
Choose the Cloud SQL network route and the connection helper separately. Either a language connector or the Auth Proxy can use private IP.
How we diagnose and fix a "too many connections" incident for Cloud Run + Postgres
When PostgreSQL runs out of connections, limit new connection attempts and capture session state before it disappears.