Soru

Zorluk: ZorDeploying and Managing Compute Engine Virtual Machines

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?

  1. Include `--provisioning-model=SPOT` to deploy the instance as a Spot VM for fault-tolerant batch execution.Cevap
  2. B
    Include `--scopes=startup-script=gs://prod-scripts/setup.sh` to define the location of the boot initialization script.
  3. Include `--metadata=startup-script-url=gs://prod-scripts/setup.sh` to configure the instance startup agent to run the script on boot.Cevap
  4. D
    Include `--on-host-maintenance=MIGRATE` to preserve running batch tasks during infrastructure maintenance.

Cevap

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.

Adım Adım Çözüm

1
Determine the correct flag for configuring Spot VM provisioning model.
Identify `--provisioning-model=SPOT` as the valid flag for creating Spot instances in gcloud compute instances create.
Spot VMs are designed for fault-tolerant batch workloads and require specifying SPOT as the provisioning model.
2
Determine the correct flag for executing a Cloud Storage startup script upon VM creation.
Identify `--metadata=startup-script-url=gs://...` as the valid key-value pair under the metadata flag.
Compute Engine guest environment reads the `startup-script-url` metadata key on boot to fetch and execute scripts directly from Cloud Storage buckets.
3
Evaluate and rule out incorrect flags.
Reject `--scopes` for script locations because scopes define API access, and reject `--on-host-maintenance=MIGRATE` because Spot instances require host maintenance policy to be `TERMINATE`.
Invalid flag usages produce syntax errors or deployment policy violations.

Anahtar Kavram

Compute Engine gcloud VM provisioning flags and guest metadata configuration
Tahmini Süre:2m 0s
Bu soruyu puanla