google-cloud-platformgoogle-cloud-schedulergcp-load-balancergoogle-cloud-internal-load-balancer

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


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?


Solution

  • 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!