Soru

Zorluk: OrtaDeploying and Managing Compute Engine Virtual Machines

A Cloud Operations engineer needs to provision a Compute Engine virtual machine instance named `data-processor-vm` in zone `us-central1-a`. The virtual machine requires an automated initial startup script stored in a Cloud Storage bucket at `gs://company-bootstrap-scripts/init-processor.sh` to execute upon system boot. Which `gcloud compute` command correctly configures the instance to use this remote script?

  1. gcloud compute instances create data-processor-vm --zone=us-central1-a --metadata=startup-script-url=gs://company-bootstrap-scripts/init-processor.shCevap
  2. B
    gcloud compute instances create data-processor-vm --zone=us-central1-a --startup-script-url=gs://company-bootstrap-scripts/init-processor.sh
  3. C
    gcloud compute instances create data-processor-vm --zone=us-central1-a --metadata-from-file=startup-script-url=gs://company-bootstrap-scripts/init-processor.sh
  4. D
    gcloud compute instances create data-processor-vm --zone=us-central1-a --scopes=startup-script-url=gs://company-bootstrap-scripts/init-processor.sh

Cevap

The command using `--metadata=startup-script-url=gs://company-bootstrap-scripts/init-processor.sh` is the correct approach.
The correct command uses `--metadata=startup-script-url=gs://company-bootstrap-scripts/init-processor.sh`. Compute Engine retrieves and runs startup scripts hosted in Cloud Storage when the `startup-script-url` key is passed within the standard `--metadata` flag.

Adım Adım Çözüm

1
Identify the mechanism Compute Engine uses for startup scripts hosted in Google Cloud Storage.
Compute Engine looks for the custom metadata key `startup-script-url`.
When a startup script resides in Cloud Storage, Compute Engine downloads the script using the `startup-script-url` metadata entry.
2
Select the correct `gcloud` flag syntax for inline metadata key-value assignment.
The flag syntax `--metadata=KEY=VALUE` is used.
`--metadata` accepts key-value pairs separated by commas, allowing `startup-script-url` to be pointed directly to the `gs://` URI.

Anahtar Kavram

Configuring Compute Engine Startup Scripts via Cloud Storage Metadata
Bu soruyu puanla