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?
- 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.Answer
- BSelect the automated resource capping policy directly within the Cloud Billing budget threshold rule settings to disable project infrastructure upon breach.
- CAssign the Billing Account Costs Manager role to the default Compute Engine service account so the project can automatically suspend its own billing.
- DEnable the Cloud Billing API at the organization node level to grant billing alerts authority to terminate project resources.
Answer
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.
Step-by-Step Solution
Key Concept
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.