A cloud engineer needs to execute a gcloud CLI command to deploy a new Compute Engine VM instance named batch-processor. The instance must execute initialization tasks on startup using a shell script located on the local workstation at ./scripts/init.sh. Additionally, the instance must run under a custom user-managed service account named [email protected]. Which flags must be included in the gcloud compute instances create command to meet these requirements? (Select TWO.)
- --metadata-from-file=startup-script=./scripts/init.shCevap
- [email protected]Cevap
- C--startup-script=./scripts/init.sh
- D
Cevap
The correct options are the flags using metadata from file for the startup script (--metadata-from-file=startup-script=./scripts/init.sh) and assigning the custom service account email ([email protected]).
To load a local script file as a startup script on a Compute Engine VM instance during provisioning, gcloud compute instances create requires the --metadata-from-file=startup-script=./scripts/init.sh flag. To assign a specific IAM service account identity to the VM instance, the --service-account flag must be passed with the service account's email address.
Adım Adım Çözüm
Anahtar Kavram
Compute Engine gcloud CLI VM creation flags for startup scripts and service account attachment