An infrastructure engineer needs to set up an isolated enterprise application environment in Google Cloud using the `gcloud` CLI. The setup requires creating a custom VPC network, provisioning a subnet with Private Google Access enabled, establishing an ingress firewall rule targeting a specific network tag, and launching a Compute Engine instance configured with that network tag.
In what order should the engineer execute these operational steps?
- 1Run `gcloud compute networks create corp-vpc --subnet-mode=custom` to create the custom VPC network.
- 2Run `gcloud compute networks subnets create corp-app-subnet --network=corp-vpc --region=us-east4 --range=10.150.0.0/24 --enable-private-ip-google-access` to create the subnet.
- 3Run `gcloud compute firewall-rules create allow-corp-https --network=corp-vpc --allow=tcp:443 --target-tags=web-frontend` to configure the firewall rule.
- 4Run `gcloud compute instances create web-server-1 --zone=us-east4-a --subnet=corp-app-subnet --tags=web-frontend` to launch the virtual machine.
Answer
The correct sequence is: first create the custom VPC network, next create the subnet with Private Google Access enabled in that network, then create the ingress firewall rule with target tags on the network, and finally deploy the VM instance into the subnet with the matching network tag.
The correct order follows Google Cloud resource dependency requirements: the custom VPC network must be created first as the parent container, followed by creating the subnetwork within that network, establishing firewall rules attached to the network with target tags, and finally deploying the Compute Engine VM into the subnet with the matching target tag.
Step-by-Step Solution
Key Concept
Deployment dependency order for Google Cloud VPC networks, subnets, firewall rules, and Compute Engine instances.