Hi all! So I’m facing an issue when deploying an App Engine Flexible service (It’s a networking issue so I’m posting here, do not hesitate to tell me if it should go elsewhere).
We have encountered a new requirement for our service to use a static IP address for outgoing communications. To do that, a specific subnet was put in place on our VPC Network with a Cloud Router and a Cloud NAT using a reserved external IP.
Now, after following the documentation it was made clear that the easy-to-use vpc_access_connector is only available to App Engine Standard. Since we use Flexible, we had to go to another solution, using the network settings instead, specifying the network and subnet, as well as specifying the ‘internal’ IP mode, as Cloud NAT does not support services with ephemeral external adresses.
Here comes my issue. Since we have a Cloud NAT configured, Private Google Access is disabled on the subnet, as it would simply be useless. (The console even shows the following message: Private Google Access is in effect (even though it has not been enabled manually) for packets sent from this subnet’s primary and secondary IP ranges because Cloud NAT is configured for those ranges.)
Still, when deploying, we encounter the following error:
Error Response: [9] Flex operation projects/PROJECT_NAME/regions/REGION/operations/OPERATION_ID error [FAILED_PRECONDITION]: An internal error occurred while processing task /app-engine-flex/insert_flex_deployment/flex_create_resources>RESSOURCE_ID: Subnetwork ‘SUBNET_NAME’ does not have Private Google Access enabled. App Engine flexible instances using internal-only IP addresses require that Private Google Access be enabled in the target subnetwork. Have a Network Admin enable Private Google Access as described in: https://cloud.google.com/vpc/docs/configure-private-google-access#enabling-pga
My question being: Since a Cloud NAT is set up (even the console acknowledges it), why can’t GAE Flex be deployed without Private Google Access? Is this a safeguard error on Google’s side or a misconfiguration on our side?
(By the way for anyone looking at a way to use a static IP address with Flex, the documentation is unclear and many comments on the internet say it’s not supported, but I can confirm the above configuration works in our tests, just make sure you enable Private Google Access or it won’t deploy)
