Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

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.

Solved Solved
0 1 482
1 ACCEPTED SOLUTION

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.

View solution in original post

1 REPLY 1

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.