QuestionQ219

Designing scalable, available, and reliable cloud-native applications

Your infrastructure team is responsible for creating and managing Compute Engine VMs. The team uses the Google Cloud console and the gcloud CLI to provision resources in the development environment.

You must ensure that every Compute Engine VM is labeled correctly for compliance reasons. When labels are missing, you need to implement corrective actions so the labels are configured appropriately without changing the existing deployment process. You want the most scalable approach. What should you do?

  • A Use a Cloud Audit Logs trigger to invoke a Cloud Function when a Compute Engine VM is created. Check for missing labels and assign them if necessary.
  • B Deploy resources with Terraform. Use the gcloud terraform vet command with a policy to ensure that every Compute Engine VM that is provisioned by Terraform has labels set.
  • C Write a script to check all Compute Engine VMs for missing labels regularly by using Cloud Scheduler. Use the script to assign the labels.
  • D Check all Compute Engine VMs for missing labels regularly. Use the console to assign the labels.
Explanation

A Cloud Audit Logs–based event trigger can invoke a function for each Compute Engine VM creation event. The function can validate the VM labels and update the instance when required, providing automatic, event-driven remediation that applies regardless of whether the VM was created through the console or gcloud CLI. Eventarc supports delivering matching Cloud Audit Logs events to Cloud Run functions, and Compute Engine audit-log triggers are supported.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!