By default, calls to the various Google Cloud APIs will resolve to a random Google-owned IP, and require outbound internet access, either via external IP, Cloud NAT, or 3rd party network appliance.
If outbound Internet is not required for the application, or not desired for security reasons, enabling Private Google Access allows VM instances to connect an internally routed prefix.
- On the subnet, turn on Private Google Access via the radio button
- By default, all egress traffic is permitted. If egress traffic is being denied deliberately, create a rule allowing egress traffic to destination 220.127.116.11/30, tcp ports 80 and 443
- Create a Private DNS zone called googleapis.com, and apply it to any networks that will use Google Private Access.
In the DNS zone, create two entries:
An A record called ‘private’ that resolves to the following 4 IP addresses:
A wildcard record ‘*’ that points to hostname ‘private’
The zone will look like this once created.
Private Google Access should now be working. To test it, ping something.googleapis.com and it should resolve to one of those 4 IP addresses
ping www.googleapis.com PING private.googleapis.com (18.104.22.168) 56(84) bytes of data.