An engineer needs to configure a `gcloud` command to deploy a Compute Engine virtual machine named `batch-processor` in zone `us-central1-a`. The VM must run using a dedicated custom service account named `[email protected]` and must automatically execute a script stored on the local administrative machine named `setup.sh` upon first boot. Which of the following flags must be included in the `gcloud compute instances create` command? (Select TWO correct answers.)
- [email protected]Cevap
- --metadata-from-file=startup-script=setup.shCevap
- C
- D--metadata=startup-script-url=setup.sh
Cevap
The command requires `[email protected]` to attach the identity of the custom service account, and `--metadata-from-file=startup-script=setup.sh` to read and upload the local bash script as the startup script.
To assign a custom service account identity and execute a local script file on startup, `gcloud compute instances create` requires `--service-account` to define the identity and `--metadata-from-file=startup-script=...` to load local file contents into the startup script metadata entry.
Adım Adım Çözüm
Anahtar Kavram
Deploying Compute Engine VMs with custom service accounts and local startup scripts via gcloud CLI
Tahmini Süre:1m 30s