A DevOps engineer is scripting the deployment of a Compute Engine instance using the `gcloud` CLI. The VM requires a local initialization script `./init.sh` to run at boot time and must run under an existing custom service account `[email protected]`. Which TWO `gcloud compute instances create` flags should be included in the command execution?
- --metadata-from-file=startup-script=./init.shCevap
- [email protected]Cevap
- C--startup-script=./init.sh
- D--iam-role=roles/editor
Cevap
The correct options are `--metadata-from-file=startup-script=./init.sh` and `[email protected]`.
To provision a Compute Engine VM with a custom service account and a local startup script, two distinct `gcloud` flags are required: `--service-account` specifies the custom service account identity, and `--metadata-from-file=startup-script=...` loads the contents of the specified local file into the VM's metadata.
Adım Adım Çözüm
Anahtar Kavram
Deploying Compute Engine Virtual Machines with custom service accounts and startup script metadata via gcloud CLI