A financial startup wants to enforce programmatic cost control for a non-critical development project. If the monthly project expenses cross $5,000, running Compute Engine virtual machine instances in that project must be automatically shut down to prevent unexpected charges. Which Google Cloud solution correctly satisfies this operational requirement?
- Configure a Cloud Billing budget threshold rule, publish programmatic notifications to a Cloud Pub/Sub topic, and deploy a Cloud Function subscribed to that topic that calls the Compute Engine API to stop running instances.Cevap
- BConfigure a Cloud Billing budget with a $5,000 threshold and select the default automatic resource termination checkbox within the Billing budget settings console.
- CConfigure a Cloud Billing budget connected to Pub/Sub, and grant the Billing Account Viewer role to the project service account so it can execute compute.instances.stop across all projects.
- DEnable the Cloud Billing API in the organization host project, set up budget alert notifications, and configure API quota limits to automatically revoke Compute Engine API access when budget limits are met.
Cevap
Configure a Cloud Billing budget threshold rule, publish programmatic notifications to a Cloud Pub/Sub topic, and deploy a Cloud Function subscribed to that topic that calls the Compute Engine API to stop running instances.
Google Cloud Billing budget alerts do not restrict or stop resource usage by default. To enforce automated actions (such as stopping Compute Engine VM instances when cost thresholds are breached), you must configure the budget to send programmatic notifications to a Cloud Pub/Sub topic and use a serverless component (like Cloud Functions or Cloud Run) to parse the notification and invoke the Compute Engine API to stop instances.
Adım Adım Çözüm
Anahtar Kavram
Cloud Billing Budgets and Automated Remediation via Pub/Sub