A cloud engineer needs to provision a single Compute Engine instance named `analytics-worker` in zone `us-east1-b`. The virtual machine must use the `e2-standard-4` machine type, must not have a public IP address assigned, and must execute a local provisioning script stored on the engineer's workstation at `/scripts/bootstrap.sh` when the instance boots up. Which `gcloud` command should the engineer run to deploy this instance?
- gcloud compute instances create analytics-worker --zone=us-east1-b --machine-type=e2-standard-4 --metadata-from-file=startup-script=/scripts/bootstrap.sh --no-addressCevap
- Bgcloud compute instances create analytics-worker --zone=us-east1-b --machine-type=e2-standard-4 --metadata=startup-script=/scripts/bootstrap.sh --no-address
- Cgcloud compute instances create analytics-worker --region=us-east1-b --machine-type=e2-standard-4 --startup-script-file=/scripts/bootstrap.sh --no-address
- Dgcloud compute instances create analytics-worker --zone=us-east1-b --machine-type=e2-standard-4 --metadata-from-file=startup-script=/scripts/bootstrap.sh --scopes=owner
Cevap
The command 'gcloud compute instances create analytics-worker --zone=us-east1-b --machine-type=e2-standard-4 --metadata-from-file=startup-script=/scripts/bootstrap.sh --no-address' correctly provisions the Compute Engine instance with the required configuration.
The correct command provisions a zonal Compute Engine instance using '--zone=us-east1-b', sets the machine type to 'e2-standard-4', uses '--no-address' to prevent public IP allocation, and uses '--metadata-from-file=startup-script=/scripts/bootstrap.sh' to properly upload and execute the local bootstrap script during instance startup.
Adım Adım Çözüm
Anahtar Kavram
Deploying Compute Engine VMs with custom startup scripts using gcloud CLI metadata flags
Tahmini Süre:1m 30s