Cost-effective solution to connect Cloud Scheduler to internal Cloud Load Balancer?

90 Views Asked by At

I am trying to set up an every-one-minute cron job using Cloud Scheduler to call an internal load balancer IP. However, I am unable to connect to the load balancer private IP from Cloud Scheduler. Is there a cost-effective solution to this problem?

I have tried the following:

Creating a Cloud Scheduler job with the following target:

type: http url: http://[internal load balancer IP] Setting the cron schedule to */1 * * * * Verifying that the Cloud Scheduler job has the necessary permissions to access the internal load balancer

However, when I try to run the Cloud Scheduler job, it fails with the following error:

Failed to connect to the load balancer private IP: Connection refused

Is there a cost-effective solution to this problem?

2

There are 2 best solutions below

0
On BEST ANSWER

Simone answer will work, but it's not the most effective.

I recommend to have a look to Cloud Run (very similar to Cloud Functions) and the brand new feature (still in preview) named direct VPC egress.

The purpose is the same as the serverless VPC connector, it bridges the serverless world managed by Google and your VPC in your project. But, you don't need any intermediary VM as you need with the serverless VPC connector, and so, it's easiest, fastest and cheapest!

0
On

Your best option is for your scheduler to trigger an equivalent Cloud Function, and use Serverless VPC Access to enable VPC access to your cloud function.

Serverless VPC Access deploys a VM that acts as a forward proxy to enable serverless services to consume your VPC. Pricing here.