A DevOps engineer needs to prevent unexpected cost overruns in a development environment. The engineering lead requests that when monthly spend reaches $5,000, all non-essential Compute Engine instances in the project must immediately stop. The engineer plans to configure a Cloud Billing budget threshold at 100%. Which configuration approach will achieve this automated outcome?
- Connect the Cloud Billing budget to a Cloud Pub/Sub topic and deploy a Cloud Function that processes the budget notification to programmatically stop the VM instances.Cevap
- BEnable the 'Auto-Cap Billing' checkbox within the Cloud Billing budget threshold settings to automatically stop Compute Engine instances when spend hits 100%.
- CAssign the Project Owner IAM role on the target project to the Cloud Billing account to enable automatic resource shutdown when the budget is breached.
- DEnable the Cloud Billing API inside the consumer workload project to activate default automatic Compute Engine VM termination rules.
Cevap
Connect the Cloud Billing budget to a Cloud Pub/Sub topic and deploy a Cloud Function that processes the budget notification to programmatically stop the VM instances.
Cloud Billing budgets provide visibility into spending by sending threshold notification emails and publishing messages to Cloud Pub/Sub topics. Because budgets do not automatically shut down GCP services or stop billing, achieving automated resource shutdown requires linking the budget to a Cloud Pub/Sub topic and implementing a Cloud Function (or Cloud Run service) to programmatically stop Compute Engine VM instances upon receiving an over-budget message payload.
Adım Adım Çözüm
Anahtar Kavram
Cloud Billing budgets do not automatically shut down resources or disable billing; automated enforcement requires connecting budget alerts to Cloud Pub/Sub and triggering serverless code (Cloud Functions/Cloud Run) to modify infrastructure state.