Google Cloud: Shared VPC and App Engine

google-app-enginegoogle-cloud-platform

I'm using Google Cloud with the following setup:

Shared VPC Host Project: has a network called 'production' with a subnet called 'app1', is shared among all other projects.

App1 Project: has a VM instance and an App Engine running on Node. The VM instance is directly connected to the shared VPC network's subnet.

The problem is that it seems impossible to connect the App Engine to the same network. When I insert the parameters in the app.yaml file it says that the network could not be found (it searches on the current project only).

So, how do I connect the App Engine instances to the VM? I've tried creating a network peering with no success.

Best Answer

Finally it's possible with AppEngine Flex: https://cloud.google.com/appengine/docs/flexible/nodejs/using-shared-vpc

In the app.yaml file, use the network settings name field to specify the fully-qualified name of the Shared VPC network:

network: name: projects/HOST_PROJECT_ID/global/networks/NETWORK_NAME

where

HOST_PROJECT_ID is the GCP project ID of the Shared VPC host project. NETWORK_NAME is the name of the Shared VPC network.

To configure the service to be part of a subnetwork named SUBNETWORK_NAME, also set >the subnetwork_name field:

network: name: projects/HOST_PROJECT_ID/global/networks/NETWORK_NAME subnetwork_name: SUBNETWORK_NAME

Related Topic