Question

Difficulty: MediumDeploying and Managing Compute Engine Virtual Machines

A cloud engineer needs to deploy stateless, fault-tolerant Compute Engine virtual machine instances for a batch processing workload using the gcloud CLI. The instances must minimize compute costs and automatically execute a setup script stored in a Google Cloud Storage bucket (gs://my-app-scripts/setup.sh) during boot. Which TWO gcloud compute instances create flag configurations should the engineer use? (Select TWO)

  1. --provisioning-model=SPOTAnswer
  2. --metadata=startup-script-url=gs://my-app-scripts/setup.shAnswer
  3. C
    --metadata-from-file=startup-script=gs://my-app-scripts/setup.sh
  4. D
    --maintenance-policy=MIGRATE

Answer

To achieve minimum compute costs for fault-tolerant workloads while executing a startup script from a Cloud Storage bucket, the engineer must specify '--provisioning-model=SPOT' to request Spot VM pricing and '--metadata=startup-script-url=gs://my-app-scripts/setup.sh' to point to the remote script path.
The combination of using '--provisioning-model=SPOT' and '--metadata=startup-script-url=gs://my-app-scripts/setup.sh' correctly provisions a low-cost Spot VM and instructs Compute Engine to fetch and execute the startup script directly from the designated Cloud Storage bucket.

Step-by-Step Solution

1
Determine the cost-optimization deployment model suitable for stateless, fault-tolerant batch workloads.
Identify that Spot VMs (configured via --provisioning-model=SPOT) provide maximum cost savings for preemptible batch jobs.
Spot instances offer up to 60-91% discounts compared to standard VMs and fit stateless, fault-tolerant batch workloads.
2
Identify the proper gcloud CLI flag for passing a startup script hosted in a Cloud Storage bucket.
Use --metadata=startup-script-url=gs://... rather than local file metadata flags.
When referencing scripts stored remotely in Cloud Storage, the startup-script-url key inside the --metadata flag is required.

Key Concept

Compute Engine Instance Deployment and Metadata Configuration
Rate this question