Skip to content
Visual explainer 3h to learn 5 steps

Google Cloud resilience, recovery drills and FinOps

Choose backup and zonal or regional designs from RPO and RTO, run a recovery drill and cut spend from autoscaling, egress and logs.

By Invicly Tech, , in Google Cloud Engineering and Services. About 10 minutes to read.

Topic 27 of 32

In short

Resilience means your service survives failures. You pick a design from two numbers: how much data you can lose (RPO) and how long you can be down (RTO). FinOps means watching what the cloud costs, and the biggest surprises are often idle capacity, data egress and logs.

Think of it like this: RPO is how many pages of homework you can afford to lose. RTO is how long you can take to redo the lost pages.

Explained simply

Things fail: a disk, a zone, sometimes a whole region. Resilience is how well your service copes. Before choosing a design, write down two numbers. RPO is how much recent data you can afford to lose, such as five minutes. RTO is how long you can afford to be down, such as one hour.

A zone is one data centre area inside a region. A multi-zone design keeps copies in two or more zones, so one zone failing does not stop you. Many managed services, such as Cloud Run, already spread across zones. A multi-region design survives a whole region failing, but costs more and is harder to run.

Backups only count if you can restore them. A recovery drill means you actually restore into a test project and time it. Compare the time and the data age with your RPO and RTO. If they do not match, change the design or the targets.

FinOps is about knowing what you spend. Turn on the billing export to BigQuery and you can query cost by service. The usual surprises are minimum instances that run all day, data leaving a region, and logs kept too long. A budget alert warns you, but it does not stop spending.

Press Play on a diagram to walk through it one step at a time.

CompareZonal, multi-zone and multi-region
Single zone
  • Cheapest
  • A zone outage means downtime
  • Fine for dev and batch jobs
Multi-zone (one region)
  • Survives one zone failing
  • Cloud Run and regional services do this for you
  • Cloud SQL high availability adds a standby zone
Multi-region
  • Survives a whole region failing
  • Costs more and adds complexity
  • Needs tested failover and data copies
CycleThe cost review loop
  1. 1
    Export billing

    Send billing data to BigQuery.

  2. 2
    Group and label

    Split cost by service and label.

  3. 3
    Find the top spend

    Look at egress, idle instances and logs.

  4. 4
    Change one thing

    Lower a floor, shorten retention.

  5. 5
    Measure again

    Check next week's bill.

  6. Back to step 1
SequenceA recovery drill, step by step
Engineer
Backup
Scratch project
  1. 1Pick latest backup or time point
    Engineer to Backup: Pick latest backup or time point
  2. 2Restore database
    Backup to Scratch project: Restore database
  3. 3Run a test query
    Engineer to Scratch project: Run a test query
  4. 4Newest row and elapsed time
    Scratch project to Engineer: Newest row and elapsed time
  5. 5Compare with RPO and RTO
    Engineer to Engineer: Compare with RPO and RTO

In depth

RPO, RTO and the cost ladder

Smaller RPO and RTO cost more. A nightly backup gives an RPO up to 24 hours and an RTO of hours. Point-in-time recovery on a database brings RPO to minutes. A warm standby in a second region brings RTO to minutes but you pay for it all the time. An active-active design aims for near zero, and is the hardest to build.

Ask the business what an hour of downtime really costs. A hobby site and an order system do not need the same design. Write the numbers in the design document, so the reason for the spend is clear.

  • Backup and restore: cheapest, slowest
  • Warm standby: partly running copy
  • Active-active: fastest, most complex
  • Choose from RPO and RTO, not from fear
LayersRecovery options from cheap to fast
  1. 1
    Active-active

    Two regions serve traffic. Near zero loss, highest cost.

  2. 2
    Warm standby

    Smaller copy always running. Minutes to switch.

  3. 3
    Pilot light

    Data copied, servers off. Start them on failure.

  4. 4
    Backup and restore

    Cheapest. Restore takes hours.

Zones, regions and what services do for you

Cloud Run is regional and runs across zones inside the region. Cloud SQL offers a high availability setup with a standby in another zone and automatic failover. Cloud Storage buckets can be regional, dual-region or multi-region, which sets where object copies are kept.

None of that protects you from a bad deployment or deleted data. Backups, versioning and tested rollbacks cover those. Also check which dependencies are single-zone, because a chain is as strong as its weakest link.

  • Regional services spread across zones
  • Cloud SQL high availability uses a standby zone
  • Bucket location type sets copy placement
  • Zone redundancy does not protect against deletion

Running a recovery drill

Pick one dataset, such as the orders database. In a scratch project, restore the latest backup or a point in time. Start a timer and write down each step. Record the age of the newest restored record, which is your real RPO, and the time until a test query works, which is your real RTO.

Then compare with the targets. If the restore took 3 hours but your RTO is 1 hour, you have a finding to fix. Delete the scratch project afterwards so you stop paying for it.

  • Use a separate project
  • Time every step
  • Check data age and a working query
  • Delete the drill project when done

Finding cost with billing export and autoscaling

Enable Cloud Billing export to BigQuery. Standard usage cost data has one row per charge, with the service, SKU, project, labels and cost. Credits and discounts appear in a separate field, so subtract them when you want the net cost. Group by service first, then by SKU.

Check three places. Minimum instances: a Cloud Run service with a floor of 2 is billed for 2 instances all day. Egress: traffic out of a region or to the internet is charged. Logs: ingestion and long retention add up. Lower the floor in dev, keep data and compute in one region, and shorten log retention where you can.

  • Group by service, then SKU
  • Subtract credits for net cost
  • Set dev minimum instances to 0
  • Keep chatty services in one region
  • Cut log retention and exclude debug lines

Learn it in 5 short steps

About 35m each. Track them with a timer in your plan.

  1. 1
    Compare multi-zone and multi-region designs~35m
  2. 2
    Set RPO and RTO and test a restore~35m
  3. 3
    Find egress and log retention costs~35m
  4. 4
    Export billing data to BigQuery~35m
  5. 5
    Tune autoscaling floors~35m

Key points

  • RPO is the data you can lose, measured in time. RTO is the time to get working again. Smaller numbers cost more.
  • A backup you have never restored is a hope, not a backup. Run a recovery drill and time it.
  • Autoscaling floors cost money: a minimum of one Cloud Run instance is billed even with no traffic.
  • Data leaving a region or the cloud (egress) and long log retention are common hidden costs.
  • Budgets send alerts but do not stop spending by themselves.

Key terms

Tap a card to flip it. 0/5 known

Examples

sql
-- Cost by service for the last 30 days (placeholder table name)
SELECT service.description AS service,
  ROUND(SUM(cost), 2) AS cost
FROM `<project-id>.billing.gcp_billing_export_v1_<billing-account-id>`
WHERE usage_start_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
GROUP BY service
ORDER BY cost DESC
LIMIT 10;

Credits are in a separate column, so this shows cost before credits.

Choose a design from RPO and RTO

The orders service says: lose at most 5 minutes of orders, be back within 1 hour. A nightly backup gives up to 24 hours of loss, so it fails the RPO. Point-in-time recovery meets 5 minutes of loss, and a restore in the same region within an hour is plausible. A second region is not required. Prove it with a drill.

text
RPO 5 min, RTO 60 min
nightly backup only   -> RPO 24 h   FAIL
PITR + same-region restore -> RPO ~min, RTO ~30 min (test it)
multi-region standby  -> works, costs more than needed

Net cost by service from billing export

You want the cost after credits for the last 30 days. Sum the cost and add the credits, which are negative numbers. Expect a few services to make up most of the bill. Use placeholder names for the table.

sql
SELECT service.description AS service,
  ROUND(SUM(cost) + SUM(IFNULL(
    (SELECT SUM(c.amount) FROM UNNEST(credits) c), 0)), 2) AS net_cost
FROM `<project-id>.billing.gcp_billing_export_v1_<billing-account-id>`
WHERE usage_start_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
GROUP BY service
ORDER BY net_cost DESC
LIMIT 10;

Quick reference

  • RPO = data you can lose; RTO = time you can be down
  • Regional services like Cloud Run spread across zones
  • Cloud SQL high availability keeps a standby in another zone
  • A backup is proven only by a timed restore
  • Billing export to BigQuery lets you query cost by service and SKU
  • Credits are separate; add them to cost for net spend
  • Budgets alert; they do not cap spend
  • Common hidden costs: minimum instances, egress, log retention

Common mistakes

  • Choosing multi-region because it sounds safe, without writing down the RPO and RTO that justify the cost.
  • Never testing a restore. Backups can be empty, old or in the wrong region.
  • Keeping debug logs for a year. Log volume quietly becomes a top cost line.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1A nightly backup gives you roughly what RPO?

Question 2

2Which design survives a whole region failing?

Question 3

3What proves a backup works?

Question 4

4A Cloud Run service with minimum instances set to 2 and no traffic is...

Question 5

5What does a budget do by default?

0/5 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    A team says RPO is 1 hour and RTO is 4 hours. Write one sentence explaining each in plain words.

  2. Exercise 2medium

    Plan a recovery drill for a Cloud SQL database in a scratch project. List the steps and what you record.

  3. Exercise 3hard

    Your monthly bill rose 40 percent. Describe how you would find the cause using billing export, and three fixes.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Do I need multi-region?
Only if your RPO and RTO need it. Many services are fine with multi-zone design and tested backups.
How do I cap my cloud spend?
Budgets only alert. To limit spend you reduce autoscaling maximums, use quotas and review costs often.
What is egress?
Network traffic leaving a region or Google Cloud. It is billed, and the price depends on the destination.

Go deeper

ShareXLinkedInWhatsApp