Batch Job + VPC Connector

Hey, is there a way to indicate which VPC connector should be used by the Batch job?

I am using the new Batch API: https://cloud.google.com/batch

and would like to enable the Mongo Connector in the Batch Job to connect to MongoDB via VPC peering.

Batch is using Compute Engine underneath, so any networking and routing will depend on the VPC to which you deploy the Job. You can specify the VPC and Subnet with the --network and --subnetwork options in gcloud to place the job into a subnet with the required connectivity, see here for more details: https://cloud.google.com/sdk/gcloud/reference/beta/batch/jobs/submit

Hope that helps.

1 Like