A Lead Site Reliability Engineer is automating the provisioning of a critical background processing VM named `worker-node-01` in the `us-central1-a` zone. The VM must connect to an existing subnet named `backend-subnet`, execute a local shell script located at `/local/config/bootstrap.sh` on startup, attach a custom service account named `[email protected]`, and strictly prevent any external IP address allocation. Which `gcloud` command correctly fulfills all these operational requirements?
- gcloud compute instances create worker-node-01 --zone=us-central1-a --subnet=backend-subnet --no-address [email protected] --scopes=cloud-platform --metadata-from-file=startup-script=/local/config/bootstrap.shAnswer
- Bgcloud compute instances create worker-node-01 --zone=us-central1-a --subnet=backend-subnet --no-address [email protected] --metadata=startup-script=/local/config/bootstrap.sh
- Cgcloud compute instances create worker-node-01 --zone=us-central1-a --subnet=backend-subnet --no-address --provisioning-model=SPOT --instance-termination-action=STOP [email protected] --metadata-from-file=startup-script=/local/config/bootstrap.sh
- Dgcloud compute instances create worker-node-01 --zone=us-central1-a --subnet=backend-subnet --no-address --scopes=roles/owner --metadata-from-file=startup-script=/local/config/bootstrap.sh
Answer
The command that correctly provisions the instance specifies `--metadata-from-file=startup-script=/local/config/bootstrap.sh` to upload the local script content, `--no-address` to block external public IP assignment, `--subnet=backend-subnet` for network placement, and `[email protected]` for identity management.
The correct command properly combines `--metadata-from-file` to read and attach the local startup script, `--no-address` to prohibit public IP creation, `--subnet` to place the VM in the dedicated subnetwork, and `--service-account` with `--scopes` to establish service identity.
Step-by-Step Solution
Key Concept
Compute Engine Instance Creation Flags and Metadata Configuration
Estimated Time:2m 0s