A site reliability engineering team needs to enforce automated cost controls that disable billing or stop project resources when a project exceeds $10,000 in monthly spending. What is the correct sequence of steps required to configure programmatic budget notifications using Google Cloud services?
- 1Create a Cloud Pub/Sub topic in the administration project to act as the message channel for budget notifications.
- 2Deploy a Cloud Function configured with an Eventarc or Pub/Sub trigger attached to the created topic to execute automated resource shutdown logic.
- 3Navigate to Cloud Billing > Budgets & Alerts and create a new budget scoped to the target project with a $10,000 target amount.
- 4Under the budget's actions settings, enable 'Connect a Pub/Sub topic to this budget' and select the created topic.
Answer
The correct sequence is: first create the Cloud Pub/Sub topic, second deploy the Cloud Function subscribed to that Pub/Sub topic, third create the Cloud Billing budget scoped to the project, and fourth connect the Pub/Sub topic under the budget's programmatic notification settings.
To build an automated budget capping system, the messaging endpoint (Cloud Pub/Sub topic) must be created first. Next, the serverless handler (Cloud Function) is deployed and configured to trigger on messages from that Pub/Sub topic. Then, the Cloud Billing budget is created with the desired spending limits. Finally, the Pub/Sub topic is linked to the budget under the manage notification actions, establishing the workflow where budget threshold events trigger automated code execution.
Step-by-Step Solution
Key Concept
Cloud Billing Budgets do not automatically cap spending by default; automated enforcement requires linking a Cloud Billing budget to a Cloud Pub/Sub topic, which triggers serverless logic (such as a Cloud Function or Cloud Run service) to cap resources programmatically.