FinOps Observer
← All labs

Google Cloud cost controls / Advanced / 45–90 min

The GCP budget notification sent to the wrong topic

Trace a budget notification to the wrong Pub/Sub topic and stop a dedicated test VM with a synthetic event.

LAB IDfinops-03-gcp-budget-stopTRACK / finops.observer
Analyst viewing cloud cost charts beside a server rack

The scenario

A project-scoped budget publishes to the wrong topic. Correct the route and test a narrowly targeted response against a disposable VM, without exceeding a real budget or disabling billing.

Mission objectives

  • Inspect the budget and two Pub/Sub topics.
  • Restore the notification route without changing the project's billing link.
  • Use a synthetic budget message to stop only the lab VM.

Lab README

The GCP budget notification sent to the wrong topic

This lab creates a real Compute Engine VM, boot disk, two Pub/Sub topics, a subscription and a project-scoped Cloud Billing budget. Review pricing and quotas first: these resources and operations can incur charges. Use a dedicated, billing-enabled non-production project. The VM has no external IP or service account. Stopping it does not delete its disk or stop all costs. A budget is not a spending cap, and cost data and notifications can be delayed.

Install Bash, Python 3 and the Google Cloud CLI. Sign in with gcloud auth login. Your identity must be able to manage Compute Engine and Pub/Sub resources in the project and budgets on its billing account. Compute Engine, Pub/Sub and Cloud Billing Budget APIs must already be enabled, and a default VPC and subnet must exist in the chosen zone. Check pricing and permissions.

export GOOGLE_CLOUD_PROJECT="your-dedicated-project-id"
export GOOGLE_CLOUD_BILLING_ACCOUNT="your-billing-account-id"
./setup.sh "$GOOGLE_CLOUD_PROJECT" "$GOOGLE_CLOUD_BILLING_ACCOUNT" us-central1-a --accept-costs
./lab.sh inspect

Inspect the live budget, topics and subscription. Repair the lab budget's route using Google Cloud tools while keeping its project filter, amount and other notification settings unchanged. Do not edit other budgets. If the installed gcloud billing budgets update crashes, use the Cloud Billing console or Billing Budget API instead.

./verify.sh
./teardown.sh

Verification publishes a synthetic over-budget message to the budget's configured topic, pulls it from the lab subscription, and stops only the identified lab VM. It does not test real billing data, Google-generated notifications or a deployed automatic responder. The lab does not disable project billing. Never use this local demonstration as a production spending guard. The related opsbreakfix.com article covers Azure, not GCP.

Setup records unique resource identities in a private .lab-state directory. Keep this state after a failure so teardown can recover. Teardown only removes the recorded lab resources and never deletes a project or billing account. Inspect Google Cloud for residual resources and charges after cleanup; remove local state only after confirming the resources are gone.

View Markdown source ↗

Get the lab

Download and inspect the installer before running it. It checks the archive's SHA-256 digest and refuses to overwrite an existing lab directory.

curl -fsSLO https://devops.download/labs/finops-03-gcp-budget-stop.sh
less finops-03-gcp-budget-stop.sh
bash finops-03-gcp-budget-stop.sh
cd labs/finops-03-gcp-budget-stop
./setup.sh "$GOOGLE_CLOUD_PROJECT" "$GOOGLE_CLOUD_BILLING_ACCOUNT" us-central1-a --accept-costs

When you've made your changes, run ./verify.sh. Remove lab resources with ./teardown.sh.

Download the archive instead ↗

Need a nudge?

Hint #1

Compare the budget's configured topic with the topic attached to the lab subscription.

Hint #2

Update only the lab budget's notification topic, preserving its project scope and other settings.

Hint #3 · Related guide on opsbreakfix.com

Read the related guide ↗

Solved it?

Explore the related guide on opsbreakfix.com.

Continue to opsbreakfix.com ↗

One ecosystem.
Many perspectives.

Follow the connection from a hands-on lab to the knowledge and tools behind it.