A cloud administrator needs to script the deployment of a Compute Engine virtual machine instance named `backend-api` into an existing Virtual Private Cloud (VPC) subnetwork named `prod-subnet`. Additionally, the deployment script must pass key-value pairs (`env=production,role=api`) to the instance metadata server upon creation. Which of the following flags should be included in the `gcloud compute instances create` command to achieve this configuration? (Select TWO answers.)
- --subnet=prod-subnetCevap
- --metadata=env=production,role=apiCevap
- C--vpc-subnet=prod-subnet
- D--custom-variables=env=production,role=api
Cevap
The correct flags to include in the `gcloud compute instances create` command are `--subnet=prod-subnet` and `--metadata=env=production,role=api`.
Specifying `--subnet=prod-subnet` ensures the VM instance connects to the intended VPC subnetwork, while `--metadata=env=production,role=api` registers the specified key-value pairs on the instance's metadata server during creation.
Adım Adım Çözüm
Anahtar Kavram
Deploying Compute Engine instances into specific subnets with custom metadata using gcloud CLI flags