🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
NEWSLIVESearch All Content
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

Backup, DR & Cross-Region Replication

GCP Data EngineeringBackup & RecoveryđŸŸĸ Free Lesson

Backup, DR & Cross-Region Replication

Master backup and disaster recovery on GCP including cross-region replication, BigQuery backups, GCS replication, and DR strategies.

14 min readIntermediate

What You'll Learn

  • 1Translate a business RPO and RTO into a concrete replication and backup design
  • 2Choose between GCS dual-region, multi-region, and versioned single-region buckets from the SLA
  • 3Recover a BigQuery table using time travel, a snapshot, or a cross-region copy
  • 4Prove a restore works by rehearsing it and measuring the real recovery time

Backups are only as good as the day you did not need them, and the difference between a recovery plan and a folder of exported files is whether anyone has ever run it. This lesson starts from the two numbers that drive every decision, recovery point objective and recovery time objective, then maps them onto the storage and warehouse primitives Google provides, and finishes with the rehearsal discipline that makes the numbers honest.

Recovery objectives decide the architecture

Recovery point objective is how much data you can afford to lose, expressed as a span of time: fifteen minutes means something must replicate or snapshot at least that often. Recovery time objective is how long the service may be down, which decides how much infrastructure must already be running somewhere else. The pair, not the technology, picks the strategy.

StrategyTypical RPOTypical RTOCost shapeSuits
Export to a second bucket or regionHours to a dayHours, plus restore timeStorage onlyCold datasets, compliance archives
Cross-region copy or snapshotMinutes to an hourUnder an hourStorage plus copy operationsWarehouses with a real deadline
Warm standbySeconds to minutesMinutesFull duplicate compute, scaled downCustomer facing services
Multi-region active activeNear zeroSecondsDuplicate everything, alwaysRevenue on the line

Pick the row your business actually needs and write down the assumptions, because the gap between an export that runs nightly and an active active design is a monthly bill that someone has to defend. Most data platforms land on the first two rows for raw archives and the third for the handful of tables that stop the business when they are missing.

GCS buckets: region, redundancy, and versioning

Cloud Storage offers single region, dual region, and multi region buckets, and they differ in how many locations hold your bytes and what the service level commits to. Durability is the same eleven nines everywhere; what changes is availability and the distance your data can fail over. A dual region bucket keeps two regions in the same geography live, and its published monthly uptime commitment is 99.99 percent, while a multi region bucket spans a continent at 99.95 percent.

python
from google.cloud import storage

client = storage.Client()

bucket = client.bucket('regulated-exports')
bucket.location = 'us-east1'
bucket.location_type = 'dual-region'
bucket.storage_class = 'STANDARD'
bucket.versioning_enabled = True

bucket = client.create_bucket(bucket, exists_ok=True)

bucket.set_iam_policy({
    'bindings': [
        {'role': 'roles/storage.objectViewer', 'members': ['group:[email protected]']}
    ]
})
print(bucket.name, bucket.location_type)

Turn on versioning for any bucket that holds source data, then write a lifecycle rule that keeps a handful of noncurrent versions and deletes the rest. Versioning alone stops a bad rm from being permanent, and combined with object retention it also survives an attacker who authenticates successfully. For archives nobody reads, downgrade old objects to Archive class rather than duplicating them into a second bucket.

BigQuery: time travel, snapshots, and copies

BigQuery has three recovery levers and they live at different price points. Time travel keeps seven days of history by default and covers deletes, overwrites, and schema mistakes at no extra storage cost. Table snapshots keep a chosen point far beyond that window and charge only for the delta since they were taken. A cross region copy puts a full duplicate in another location for a genuine regional failure.

python
from google.cloud import bigquery

client = bigquery.Client()

job = client.copy_table(
    'my-project:analytics.sales',
    'my-project:dr_backup.sales',
    job_config=bigquery.CopyJobConfig(
        write_disposition=bigquery.WriteDisposition.WRITE_TRUNCATE
    ),
    location='us'
)
job.result()

check = client.query(
    'SELECT COUNT(*) FROM `my-project:dr_backup.sales`'
).result()
print('restored rows:', list(check)[0][0])

Remember that a cross region copy moves data across a billing boundary, and that the copy inherits your encryption configuration, so the recovery project needs the same key access or the restore fails at the end. For datasets where only a few tables matter, snapshot those tables instead of copying the whole dataset; snapshots are incremental and cost a fraction of a full duplicate.

Streaming pipelines, metadata, and the rest of the stack

Storage recovery is the easy half. Streaming pipelines have in flight state, and the honest answer for a Dataflow job is that you redeploy it: keep the pipeline in source control, keep the template or container immutable, and make the sink idempotent so replayed messages from the source do not duplicate rows. Pub/Sub holds unacked messages until acknowledgement or expiry, which buys you time to bring consumers up in a second region, but only if the subscription and its dead letter policy already exist there.

Orchestrators need the same treatment. Cloud Composer environments back their metadata database up automatically, yet a backup is only useful with a documented path to create a new environment, import the DAGs from the bucket, and repoint the schedule. Record which environment variables, connections, and secrets have to be recreated by hand, because those never travel with the database export. The same logic applies to Vertex AI pipelines, model artifacts, and the feature store: a design that assumes the control plane is reachable is not a design for a regional outage.

What the copies actually cost

Redundancy has three line items: the second copy of the bytes, the operations that keep it fresh, and the egress when a restore moves data back to where users are. Cross region storage costs more than single region storage, cross region copies bill for read and write against the source, and serving recovered data out of a region other than the one your users sit in adds network charges on top.

The lever that keeps the bill sane is tiering. Keep the primary copy in Standard, move anything older than a quarter to Nearline or Coldline, and take snapshots instead of full copies for tables that change rarely, since a snapshot bills only for the bytes added since the previous one. Then align the tiers with the recovery objectives: a dataset whose recovery point objective is a week does not need live replication, and paying for it is money spent on an availability level nobody asked for.

Rehearse the restore, then measure it

A recovery plan without a rehearsal is a hypothesis. Run the drill on a schedule: pick a table, restore it from the cross region copy into a scratch project, compare row counts and a checksum of a numeric column against the source, and time how long each step took. The measured time becomes your real recovery time objective, and it is almost always longer than the one written on the slide.

# Verify a restored table before declaring the drill a success
bq query --use_legacy_sql=false "
  SELECT
    (SELECT COUNT(*) FROM \`p.dr_backup.sales\`) AS restored,
    (SELECT COUNT(*) FROM \`p.analytics.sales\`) AS source,
    (SELECT COUNT(*) FROM \`p.dr_backup.sales\` s
      JOIN \`p.analytics.sales\` a USING (order_id)) AS matched
"

gcloud storage du --sizes --summarize gs://regulated-exports/ | tail -1

Automate the drill where you can. A monthly job that restores the newest snapshot, asserts the counts, writes the duration to a metrics stream, and pages nobody when it passes gives you trend data; when it fails, you learn before an incident does. Keep the runbook next to the numbers, with the exact commands, the person who owns the decision to fail over, and the point at which you stop trying to repair the primary region and cut over instead.

Common Mistakes

Treating the eleven nines durability figure as an availability guarantee

Fix: Durability covers bit rot and hardware loss; availability is the SLA, 99.99 percent for dual region and 99.95 percent for multi region, and it is what your RTO rests on.

Copying a dataset cross region and never verifying the copy

Fix: Assert row counts and a checksum in the same job that copies, so a truncated restore fails loudly while the data is still fresh.

Designing recovery without rehearsing it

Fix: Run a quarterly drill against a scratch project, time each step, and rewrite the recovery time objective with the number you measured.

Best Practices

  • Tier data by how fast it must come back and give every tier an explicit RPO and RTO
  • Combine versioning with lifecycle rules so protection never becomes an unbounded storage bill
  • Keep the pipeline definition and secrets in source control so a region failover is a redeploy

Key Takeaways

  • RPO sets replication frequency, RTO sets how much infrastructure must already be running elsewhere
  • GCS durability is eleven nines across all location types; availability is what differs between them
  • BigQuery offers free seven day time travel, incremental snapshots, and full cross region copies as three price points
  • A measured restore time replaces the assumed one, and only a rehearsal produces it

Interview Questions

Q1: What is the difference between RPO and RTO?

Recovery point objective is the maximum data loss you accept, expressed in time, and it drives how often you replicate or snapshot. Recovery time objective is the maximum acceptable outage, and it drives how much infrastructure must already exist elsewhere ready to take traffic.

Q2: Dual region or multi region bucket for critical data?

Dual region keeps two regions in one geography live with a 99.99 percent monthly uptime commitment and lower latency between them, which suits most critical workloads. Multi region spans a continent at 99.95 percent and is chosen when data residency or continental failover matters more than the tighter SLA.

Q3: What are the recovery options for a BigQuery table?

Time travel for anything inside the seven day window, a table snapshot for points beyond it at incremental cost, a cross region copy for regional failure, and an export to GCS as the last resort when the warehouse itself is unavailable.

Q4: How do you handle disaster recovery for a streaming pipeline?

Keep the pipeline definition in source control and the container immutable so recovery is a redeploy, make the sink idempotent so replays do not duplicate rows, and pre-create the subscription and dead letter policy in the secondary region so consumers can start without console work.

Q5: How often should DR procedures be tested?

On a fixed schedule, commonly quarterly, with each drill restoring into a scratch project, verifying row counts and checksums, and recording the elapsed time. The recorded time is your real recovery time objective and usually differs from the documented one.

CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-10-14

—
☆☆☆☆☆
0 ratings

Rate & Feedback

Need Expert GCP Data Engineering Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement