Question

Difficulty: HardDeploying and Managing Compute Engine Virtual Machines

An operations team needs to deploy a production backend Virtual Machine named `app-backend-prod` in zone `us-central1-a` using the `e2-standard-4` machine type. According to organization security compliance rules, the instance must connect to a custom subnetwork named `prod-app-subnet` within `prod-vpc`, must be assigned a fixed internal IP address of `10.150.0.45`, must not have a public external IP address attached, and must include the network tag `allow-internal-api` for firewall matching. Which `gcloud` command correctly provisions this Compute Engine VM instance?

  1. gcloud compute instances create app-backend-prod --zone=us-central1-a --machine-type=e2-standard-4 --network=prod-vpc --subnet=prod-app-subnet --private-network-ip=10.150.0.45 --no-address --tags=allow-internal-apiAnswer
  2. B
    gcloud compute instances create app-backend-prod --zone=us-central1-a --machine-type=e2-standard-4 --network=prod-vpc --subnet=prod-app-subnet --internal-ip=10.150.0.45 --external-ip=none --target-tags=allow-internal-api
  3. C
    gcloud compute instances create app-backend-prod --zone=us-central1-a --machine-type=e2-standard-4 --network=prod-vpc --subnet=prod-app-subnet --private-network-ip=10.150.0.45 --no-address --tags=allow-internal-api --provisioning-model=SPOT
  4. D
    gcloud compute instances create app-backend-prod --zone=us-central1-a --machine-type=e2-standard-4 --network=prod-vpc --subnet=prod-app-subnet --scopes=https://www.googleapis.com/auth/cloud-platform --no-address --tags=allow-internal-api

Answer

The command starting with 'gcloud compute instances create app-backend-prod --zone=us-central1-a --machine-type=e2-standard-4 --network=prod-vpc --subnet=prod-app-subnet --private-network-ip=10.150.0.45 --no-address --tags=allow-internal-api' is correct.
The correct response accurately combines `--private-network-ip=10.150.0.45` to set the fixed internal IP, `--no-address` to disable external IP assignment, and `--tags=allow-internal-api` to apply network tags on the specified subnet within `prod-vpc`.

Step-by-Step Solution

1
Identify the proper gcloud CLI flag for assigning a static internal IP address during instance creation.
The correct flag is `--private-network-ip=10.150.0.45`.
Compute Engine CLI uses `--private-network-ip` to specify custom internal IPv4 addresses for primary network interfaces.
2
Identify the proper gcloud CLI flag to prevent allocating an external IP address.
The correct flag is `--no-address`.
By default, gcloud assigns an ephemeral external IP unless `--no-address` is explicitly declared.
3
Identify the network tag flag for firewall rule association on compute instances.
The correct flag is `--tags=allow-internal-api`.
Firewall rules inspect instance network tags specified via `--tags` (unlike target tags specified in firewall rule resources).
4
Verify provisioning model parameters against application workload requirements.
Production core backends must use standard provisioning, avoiding Spot/Preemptible flags.
Spot instances can be reclaimed by GCP at any time and do not guarantee uptime SLAs.

Key Concept

Deploying Compute Engine instances with custom networking flags in gcloud CLI
Rate this question