Scheduling periodic jobs with Cloud Scheduler ⏰
Cloud Scheduler is a fully managed enterprise-grade cron job scheduler. It allows you to schedule virtually any job, including batch, big data jobs, cloud infrastructure operations, and more.
Automating tasks that re-occur is definitely at the heart of every software developer. Google Cloud Platform has a tool that allows users to schedule jobs while maintaining the usual unix-cron format.
Cloud Scheduler can be referred to as Cronjob as a Service tool, it is fully managed by Google Cloud Platform so you don't need to manage the scheduler's underlying infrastructure.
Cloud Scheduler can be used for multiple use cases such as making requests to an HTTP/S Endpoint, invoking a Pub/Sub topic, making database updates and push notifications, triggering CI/CD pipelines, scheduling tasks such as image uploads and sending an email, or even invoking Cloud Functions.
In this article, we would simply use Cloud Scheduler to make simple requests to an HTTP Endpoint.
Setting up Cloud Scheduler
Visit Cloud Scheduler and click on ➕ Create Job
- Enter job name
- Set Frequency : every 24 hours
- Target : Select HTTP
- Set URL : (Use your Application or Functions URL)
- HTTP Method : Select GET
You can change values above to fit your use case.
I wrote a tool that utilizes Cloud Scheduler to keep Serverlesss services warm.
Cloud Scheduler can also be used with Firebase Cloud Functions which automatically configures Cloud Scheduler, along with a Pub/Sub topic, that invokes the function that you define using the Cloud Functions for Firebase SDK. Read more
In addition, Stackdriver integrates with Cloud Scheduler providing powerful logging for greater transparency into job execution and performance.
Cloud Scheduler is simple and pay-for-use; where you pay for the number of jobs you consume per month. Google Cloud generously also allows you create 3 free jobs per month while you only per for others at $0.10/job/month