Question

Difficulty: MediumManaging Networking Resources

A cloud engineer needs to configure network access for administrative maintenance on private Compute Engine instances in a custom VPC network. The instances do not have external IP addresses. The engineer wants to enable secure SSH access through Identity-Aware Proxy (IAP) TCP forwarding without exposing the instances to the public internet. Which two operational steps must be performed to meet these networking requirements?

  1. Create an ingress firewall rule in the VPC network allowing TCP traffic on port 22 from the source IP range 35.235.240.0/20.Answer
  2. Execute the command gcloud compute ssh specifying the --tunnel-through-iap flag when connecting to the VM instance.Answer
  3. C
    Create an egress firewall rule allowing outbound TCP traffic on port 22 from the VM instances to destination IP range 35.235.240.0/20.
  4. D
    Configure a Cloud NAT gateway in the subnet and set its public IP address as the source IP range in the ingress firewall rule.

Answer

To securely access private VM instances via IAP TCP forwarding, you must create an ingress firewall rule in the custom VPC allowing TCP port 22 from the IAP proxy CIDR range 35.235.240.0/20, and connect using gcloud compute ssh with the --tunnel-through-iap flag.
Enabling Identity-Aware Proxy (IAP) TCP forwarding requires allowing ingress TCP traffic on port 22 from Google's dedicated IAP range (35.235.240.0/20) into the VPC network. Additionally, connecting to a private VM without a public IP requires passing the --tunnel-through-iap flag to gcloud compute ssh.

Step-by-Step Solution

1
Identify the ingress firewall requirement for IAP TCP forwarding.
Recognize that IAP connections originate from Google's dedicated IP block 35.235.240.0/20.
VPC firewall rules block incoming traffic by default, so explicit ingress permission for port 22 from 35.235.240.0/20 must be allowed.
2
Select the correct gcloud CLI connection method for private instances.
Use gcloud compute ssh with the --tunnel-through-iap flag.
Since the VM instance lacks an external IP address, standard direct SSH connections fail; tunneling through IAP establishes the connection securely over GCP APIs.

Key Concept

Identity-Aware Proxy (IAP) TCP Forwarding for VPC Network Management
Rate this question