Soru

Zorluk: OrtaCreating Billing Budgets, Alerts, and BigQuery Exports

A DevOps engineer is configuring governance controls on Google Cloud to prevent budget overruns in a development environment. When monthly expenditure reaches 80% of the defined threshold, non-essential Compute Engine instances must be stopped automatically. Which configuration strategy correctly enables this programmatic action?

  1. Link a Cloud Pub/Sub topic to the Cloud Billing budget notification settings, and write a Cloud Function triggered by Pub/Sub messages to stop the target instances.Cevap
  2. B
    Select the automated resource capping policy directly within the Cloud Billing budget threshold rule settings to disable project infrastructure upon breach.
  3. C
    Assign the Billing Account Costs Manager role to the default Compute Engine service account so the project can automatically suspend its own billing.
  4. D
    Enable the Cloud Billing API at the organization node level to grant billing alerts authority to terminate project resources.

Cevap

Publish budget threshold alerts to a Cloud Pub/Sub topic, which triggers a Cloud Function programmatically designed to call Compute Engine APIs and stop running instances.
Cloud Billing budgets send notifications via email and Pub/Sub topics when actual or forecasted spend crosses specified threshold percentages. To achieve automated resource shutdown or cost capping, you must publish budget messages to a Pub/Sub topic and consume those messages with an automated service such as a Cloud Function that calls the Compute Engine API to stop instances.

Adım Adım Çözüm

1
Configure budget alert settings in Cloud Billing
Budget threshold rules (e.g., 80% of budget) are set to send notifications.
Budgets track current and forecasted costs against specified spending limits.
2
Attach a Cloud Pub/Sub topic to the billing budget
JSON-formatted billing alert messages are published to the topic when thresholds are met.
Native GCP billing budgets only publish event messages and send emails; they cannot directly stop resources.
3
Deploy an event-driven Cloud Function or Cloud Run service
The function executes upon receiving Pub/Sub messages and uses Compute Engine APIs to stop non-essential VMs.
Programmatic cost control requires custom code listening to Pub/Sub events.

Anahtar Kavram

Cloud Billing budgets issue email and Pub/Sub notifications but require Pub/Sub subscriber integration (such as Cloud Functions) to automate resource enforcement or shutdown.
Bu soruyu puanla