An infrastructure administrator needs to deploy a Compute Engine virtual machine instance named `db-proxy-01` in the `us-central1-a` zone to handle sensitive internal database proxying. The virtual machine must reside in an existing custom subnetwork named `prod-db-subnet`, must not be exposed to the public internet, must attach an existing secondary persistent disk named `data-disk-01` in read-only mode, and must run using a dedicated service account `[email protected]` instead of the default Compute Engine service account. Which `gcloud` command accurately provisions this virtual machine according to all technical requirements?
- gcloud compute instances create db-proxy-01 --zone=us-central1-a --subnet=prod-db-subnet --no-address --disk=name=data-disk-01,mode=ro [email protected]Answer
- Bgcloud compute instances create db-proxy-01 --zone=us-central1-a --subnetwork=prod-db-subnet --network-interface=no-address --attach-disk=name=data-disk-01,read-only=true [email protected]
- Cgcloud compute instances create db-proxy-01 --zone=us-central1-a --subnet=prod-db-subnet --no-address --disk=name=data-disk-01,mode=ro [email protected] --provisioning-model=SPOT
- Dgcloud compute instances create db-proxy-01 --zone=us-central1-a --subnet=prod-db-subnet --no-address --disk=name=data-disk-01,mode=ro --scopes=https://www.googleapis.com/auth/cloud-platform
Answer
The command that uses '--subnet=prod-db-subnet', '--no-address', '--disk=name=data-disk-01,mode=ro', and '[email protected]' correctly provisions the instance.
The correct command combines the required flags accurately: '--subnet=prod-db-subnet' places the instance in the specified subnetwork, '--no-address' prevents external public IP allocation, '--disk=name=data-disk-01,mode=ro' attaches the existing disk in read-only mode, and '[email protected]' enforces the custom identity.
Step-by-Step Solution
Key Concept
gcloud Compute Engine VM creation flag syntax and identity configuration