0
votes

I would like a Google Cloud Function in projectA to be able to connect to a Google Compute Engine instance in projectB. I'm aware that I need a VPC Serverless Connector in order to accomplish this and have followed the advice at Cloud Functions > Guides > Connecting to a VPC network however it doesn't work for me. When I try to deploy my cloud function the deployment "hangs" and eventually fails after many many minutes of attempting to create the function.

I am wondering if perhaps I should follow the advice at Cloud Functions > Guides > Connecting to a Shared VPC network instead. As I said above my Cloud Function and GCE instance are in different projects, does this mean I must create a Shared VPC? I am not at all familiar with Shared VPCs at all so would appreciate some guidance here.

1
You can go with a VPC Peering to connect both VPCs. Always remember that VPCs are private networks so by default you cannot connect to resources in different VPCs even in the same projectFerregina Pelona

1 Answers

0
votes

Shared VPC is a solution, but the @FerreginaPelona comment is also true: 2 projects 2 VPC strictly isolated.

You need to create a bridge (a peering) between both. Be careful to not overlap the subnet ranges (thing that happens when you use the default VPC created automatically in your project.) You need to create custom VPC with only the required subnet and then to peer them.