Question

Difficulty: MediumDeploying Virtual Private Cloud (VPC) Networks, Subnets, and Firewall Rules

A cloud engineer needs to deploy a secure web server workload using the Google Cloud CLI (`gcloud`). The architecture requires a dedicated custom-mode Virtual Private Cloud (VPC) network, a custom subnet in the `us-central1` region, an ingress firewall rule allowing HTTP traffic to instances with the network tag `web-server`, and a Compute Engine virtual machine instance provisioned inside the custom subnet. What is the correct sequence of operational steps to deploy this infrastructure from scratch?

  1. 1Execute `gcloud compute networks create` with `--subnet-mode=custom` to create the VPC network.
  2. 2Execute `gcloud compute networks subnets create` specifying the network name, region, and IP range.
  3. 3Execute `gcloud compute firewall-rules create` specifying the network, target tag `web-server`, and allowed port 80.
  4. 4Execute `gcloud compute instances create` specifying the custom subnet and adding `--tags=web-server`.

Answer

The correct sequence starts by creating the custom-mode VPC network, followed by creating the custom subnet in the target region, then creating the ingress firewall rule with target network tags, and finally provisioning the Compute Engine instance attached to the subnet with the matching network tag.
Google Cloud resource hierarchy and dependency constraints dictate that a parent custom VPC network must be created first (`--subnet-mode=custom`). Next, regional subnets must be defined within the network. Ingress firewall rules targeting specific network tags can then be associated with the network. Finally, Compute Engine instances are launched inside the provisioned subnet with matching network tags applied.

Step-by-Step Solution

1
Create custom-mode VPC network
Establishes the global network resource shell.
Parent VPC network resources must precede child subnet and firewall rule objects.
2
Create regional custom subnet
Allocates a dedicated CIDR block within the custom VPC network.
Instances in custom-mode networks require a pre-allocated subnet for network interface binding.
3
Configure ingress firewall rule
Applies network security rules filtering traffic by target tags.
Configuring security boundaries on the VPC network prepares the environment for safe instance placement.
4
Provision Compute Engine VM instance
Deploys the VM attached to the subnet and binds the `web-server` tag.
The VM relies on existing subnet infrastructure and inherits firewall policies matching its assigned tag.

Key Concept

Google Cloud infrastructure deployment order and resource dependencies for custom VPC networks, subnets, firewall rules, and tagged Compute Engine VMs.
Rate this question