A cloud administrator needs to deploy a custom Virtual Private Cloud (VPC) environment in Google Cloud using the gcloud CLI. The environment must host a web application and include a custom network, a region-specific subnet, an ingress firewall rule restricted by network target tags, and a virtual machine instance. Arrange the following administrative steps in the correct chronological execution order from first to last.
- 1Run `gcloud compute networks create prod-vpc --subnet-mode=custom` to create the parent VPC network.
- 2Run `gcloud compute networks subnets create prod-subnet-uscentral1 --network=prod-vpc --region=us-central1 --range=10.100.0.0/24` to provision the regional subnet.
- 3Run `gcloud compute firewall-rules create allow-prod-https --network=prod-vpc --allow=tcp:443 --target-tags=web-server` to configure the ingress firewall rule.
- 4Run `gcloud compute instances create web-vm-1 --zone=us-central1-a --subnet=prod-subnet-uscentral1 --tags=web-server` to deploy the Compute Engine instance.
Answer
The correct execution order is: 1) Create the custom VPC network (`prod-vpc`), 2) Provision the regional subnet (`prod-subnet-uscentral1`), 3) Create the ingress firewall rule (`allow-prod-https`), 4) Deploy the Compute Engine instance (`web-vm-1`).
In Google Cloud networking, resource creation follows a strict strict dependency hierarchy. First, the custom VPC network (`prod-vpc`) must be initialized using `--subnet-mode=custom` so that default subnets are not created. Next, a specific regional subnet (`prod-subnet-uscentral1`) must be created within that network to define the primary internal CIDR range. Third, the ingress firewall rule (`allow-prod-https`) is added to the network to allow HTTPS traffic on TCP port 443 targeted to the tag `web-server`. Finally, the Compute Engine virtual machine (`web-vm-1`) is created inside the subnet and assigned the `web-server` tag, completing the deployment.
Step-by-Step Solution
Key Concept
Resource dependency hierarchy in GCP VPC network provisioning (VPC Network → Subnet → Firewall Rule → VM Instance).