google-cloud-platformgoogle-cloud-networkinggoogle-cloud-vpn

GCP: how to only use the VPN on some domains


I have setup a HA VPN between AWS VPC and GCP VPC, now I can access private resources on AWS from GCP, my question is, is it possible to only use the VPN for certain resources? using their domain name for example.

lets say we have a publicly accessible DB and a private DB, I want to use the VPN to access the private DB but only use the internet gateway to access the public DB.


Solution

  • This should be configured on your routing on both platforms.

    In networking, routes are configured to select the right network path for network traffic. If the resolved public or private are routed on a certain network or VPN it should be routed into it.

    Also, if applicable you may use private DNS to resolve it immediately on the local network.