Soru

Zorluk: Çok zorDeploying and Managing Compute Engine Virtual Machines

Your organization is deploying a fault-tolerant batch processing workload on Google Cloud Compute Engine. The operational requirements state that the Virtual Machine (VM) instance must be provisioned using the lowest possible compute cost model, execute an automated initialization script stored in a Cloud Storage bucket at gs://company-scripts-bucket/init.sh upon booting, and run under the identity of a pre-created custom IAM service account named [email protected] with the standard cloud-platform scope. Which gcloud command correctly provisions this VM instance with all required configurations?

  1. gcloud compute instances create batch-worker-vm --zone=us-central1-a --provisioning-model=SPOT --service-account=batch-worker@app-project.iam.gserviceaccount.com --scopes=cloud-platform --metadata=startup-script-url=gs://company-scripts-bucket/init.shCevap
  2. B
    gcloud compute instances create batch-worker-vm --zone=us-central1-a --provisioning-model=SPOT [email protected] --metadata=startup-script=gs://company-scripts-bucket/init.sh
  3. C
    gcloud compute instances create batch-worker-vm --zone=us-central1-a --provisioning-model=STANDARD --service-account=batch-worker@app-project.iam.gserviceaccount.com --scopes=roles/editor --metadata=startup-script-url=gs://company-scripts-bucket/init.sh
  4. D
    gcloud compute instances create batch-worker-vm --zone=us-central1-a --maintenance-policy=MIGRATE --service-account=batch-worker@app-project.iam.gserviceaccount.com --scopes=cloud-platform --metadata=startup-script-url=gs://company-scripts-bucket/init.sh

Cevap

The command that uses --provisioning-model=SPOT, --service-account=batch-worker@app-project.iam.gserviceaccount.com, --scopes=cloud-platform, and --metadata=startup-script-url=gs://company-scripts-bucket/init.sh correctly meets all deployment requirements.
The command specifying --provisioning-model=SPOT configures the VM as a Spot instance for maximum cost savings on fault-tolerant tasks. The --service-account flag attaches the custom service account email, --scopes=cloud-platform grants full Cloud API access managed by IAM, and --metadata=startup-script-url=gs://... instructs Compute Engine to retrieve and run the script from Cloud Storage at boot time.

Adım Adım Çözüm

1
Identify the cost requirement for fault-tolerant batch workloads.
Spot VMs (--provisioning-model=SPOT) provide up to 60-91% discounts compared to standard VMs and are ideal for batch jobs.
Fault-tolerant workloads can withstand VM preemption, making Spot instances the most cost-effective option.
2
Identify the proper gcloud flags for IAM service account assignment.
Use --service-account to set the identity and --scopes=cloud-platform to delegate scope management to IAM roles.
The --scopes flag defines OAuth scopes for the instance, while --service-account specifies the service account email.
3
Identify the correct metadata key for Cloud Storage startup scripts.
Use --metadata=startup-script-url=gs://... to point to a script stored in Cloud Storage.
The key startup-script is reserved for inline bash commands/scripts, whereas startup-script-url fetches the file directly from a Cloud Storage bucket URI.

Anahtar Kavram

Compute Engine VM Provisioning with gcloud CLI, Custom Metadata, Service Accounts, and Spot VMs
Bu soruyu puanla