Question

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

A cloud engineer is deploying a custom VPC network named `prod-vpc` with multiple subnets across different regions. To secure an internal microservice running on Compute Engine instances within `subnet-backend`, the engineer needs to allow ingress TCP traffic on port 8080 specifically to these backend instances without exposing other instances in `prod-vpc`. Which configuration approach correctly achieves this selective access?

  1. Create an ingress firewall rule specifying target network tags assigned to the backend instances, with port 8080 allowed for the required source IP range.Answer
  2. B
    Create an ingress firewall rule applying to all instances in the network and set its priority to 65535 so that lower-priority numerical values do not override it.
  3. C
    Attach an IAM policy at the project level granting the Editor role to the backend service account so that network ports are automatically filtered by role assignment.
  4. D
    Apply a project-level IAM deny policy to all other VMs in `prod-vpc` to override network-level firewall rule evaluations for port 8080.

Answer

Create an ingress firewall rule specifying target network tags assigned to the backend instances, with port 8080 allowed for the required source IP range.
Specifying target network tags on an ingress firewall rule allows the rule to apply strictly to Compute Engine instances labeled with those network tags, isolating port 8080 access to the intended microservice workloads without affecting other VMs in the VPC.

Step-by-Step Solution

1
Identify the target instances requiring specific port access
Network tags (or service accounts) are assigned to the target backend Compute Engine instances.
Firewall rules in Google Cloud VPC use target network tags or target service accounts to restrict applicability to specific instances.
2
Configure ingress firewall rule parameters
Define direction as Ingress, action as Allow, protocol/port as tcp:8080, and target tags matching the backend instances.
This ensures only instances bearing the specified tag allow incoming traffic on port 8080.

Key Concept

Target network tags in GCP firewall rules allow selective rule application to specific VM instances inside a VPC network.
Estimated Time:1m 30s
Rate this question