Question

Difficulty: HardDeploying and Managing Compute Engine Virtual Machines

A cloud engineer is authoring an automated shell script to deploy Compute Engine virtual machines dedicated to nightly batch analytics processing. The processing jobs are fault-tolerant, stateless, and require aggressive cost optimization. Additionally, each VM must automatically execute a boot configuration script located on the local administrator machine at `/local/config/init.sh` upon startup. Which flags should be included in the `gcloud compute instances create` command to satisfy these operational requirements? (Select TWO)

  1. --provisioning-model=SPOTAnswer
  2. --metadata-from-file=startup-script=/local/config/init.shAnswer
  3. C
    --scopes=startup-script=/local/config/init.sh
  4. D
    --metadata=startup-script=/local/config/init.sh

Answer

The correct options are the flag specifying the SPOT provisioning model and the flag using metadata-from-file to pass the local startup script path.
For fault-tolerant batch workloads, specifying `--provisioning-model=SPOT` ensures the instance runs on GCP excess capacity at significant cost savings. Furthermore, to pass a script stored on the client machine to Compute Engine instance metadata for execution at boot, `--metadata-from-file` must be used so that `gcloud` reads the file content prior to API submission.

Step-by-Step Solution

1
Analyze the compute workload cost and reliability constraints.
Since the workload consists of fault-tolerant and stateless batch processing, selecting Spot VMs via `--provisioning-model=SPOT` optimizes cost.
Spot instances offer up to 60-91% discounts over standard instances in exchange for preemption readiness.
2
Determine the proper gcloud CLI flag for loading a local script onto a new Compute Engine instance.
Use `--metadata-from-file=startup-script=/local/config/init.sh` to read the script contents from disk.
Standard `--metadata` only assigns literal string values, whereas `--metadata-from-file` parses the contents of the file on the local machine executing the command.

Key Concept

Compute Engine instance deployment flags for Spot VMs and local startup script metadata.
Rate this question