2

I'm trying to connect App Engine application to MongoDB Cloud over a peering connection.

All services in my GCP are using non-default network called "main". I've setup peering connection with terraform:

resource "google_compute_network_peering" "mongodb_peering" {
  name         = "mongodb-peering"
  network      = google_compute_network.main.self_link
  peer_network = "projects/${mongo-cloud-project}/global/networks/${mongo-cloud-network}"
}

It works as expected.

Presumably App Engine uses default VPC network.

When I'm trying to create second connection on the default network I'm getting error because of overlapping ranges. So, I've just deleted the peering with main network and set up a new one with the default network.

Still the App Engine application cannot connect to mongodb over the peering connection.

App.yaml:

runtime: nodejs12

instance_class: F4

handlers:

  • url: /.* secure: always redirect_http_response_code: 301 script: auto

automatic_scaling: max_instances: 2 max_concurrent_requests: 80

inbound_services:

  • warmup

1 Answers1

0

You cannot have 2 or more VPC peerings that in your case, uses the same overlapping IP Ranges. This will create confusion since the routes will be created with the same priority.

And as @jabbson pointed out, the app is not using any of your networks by default. so you'll need to create a serverless VPC access connector to connect your VPCs.

James S
  • 241