A DevOps engineer is preparing a `gcloud` command to deploy a batch-processing worker VM instance on Compute Engine. The workload is stateless and fault-tolerant, so it should be deployed using Spot VM pricing to minimize costs. The instance must also execute an initialization script stored in a Cloud Storage bucket (`gs://prod-scripts/setup.sh`) during its initial boot sequence. Which TWO `gcloud compute instances create` command parameters must be included to meet these operational and cost requirements?
- Include `--provisioning-model=SPOT` to deploy the instance as a Spot VM for fault-tolerant batch execution.Answer
- BInclude `--scopes=startup-script=gs://prod-scripts/setup.sh` to define the location of the boot initialization script.
- Include `--metadata=startup-script-url=gs://prod-scripts/setup.sh` to configure the instance startup agent to run the script on boot.Answer
- DInclude `--on-host-maintenance=MIGRATE` to preserve running batch tasks during infrastructure maintenance.
Answer
The correct parameters are specifying `--provisioning-model=SPOT` to provision the instance under the Spot VM model for fault-tolerant workloads, and `--metadata=startup-script-url=gs://prod-scripts/setup.sh` to direct the guest startup agent to download and run the initialization script from Cloud Storage.
Specifying `--provisioning-model=SPOT` configures Compute Engine to allocate preemption-eligible capacity at reduced cost suitable for fault-tolerant batch jobs. Specifying `--metadata=startup-script-url=gs://prod-scripts/setup.sh` utilizes the native guest environment metadata key `startup-script-url` to download and execute the initialization script from Cloud Storage at instance boot.
Step-by-Step Solution
Key Concept
Compute Engine gcloud VM provisioning flags and guest metadata configuration
Estimated Time:2m 0s