IAP TCP forwarding allows you to establish an encrypted tunnel over which you can forward SSH, RDP, and other traffic to VM instances. IAP TCP forwarding also provides you fine-grained control over which users are allowed to establish tunnels and which VM instances users are allowed to connect to.
To allow RDP and SSH access to all VM instances in your network, do the following:
Name: allow-ingress-from-iap
Direction of traffic: Ingress
Target: All instances in the network
Source filter: IP ranges
Source IP ranges: 35.235.240.0/20
Protocols and ports: Select TCP and enter 22,3389 to allow both RDP and SSH.
Task | Roles | More information |
TCP forwarding | IAP-secured Tunnel User (roles/iap.tunnelResourceAccessor) | See Grant access to all VM instances in a projector Grant access to a specific VM. |
SSH access | Compute Instance Admin (v1) (roles/compute.instanceAdmin.v1) | |
Use a service account | Service Account User (roles/iam.serviceAccountUser) | See The serviceAccountUser role. |
Go to your VM instance and click it
Edit mode
Find for Management section
Look for Automation section
Inside the text box, type "ufw allow 22"
Save
Stop VM instance
Start VM instance
Connect again