Scheduling periodic jobs with Cloud Scheduler ⏰

Timothy
Google Cloud - Community
2 min readDec 2, 2019

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.

If you face problems with HTTP headers or other issues while using Cloud Scheduler, feel free to check out John Hanley’s answers on Stack Overflow.

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.

Pricing

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 to create 3 free jobs per month while you only per for others at $0.10/job/month

Awesome Resource

📖 Cloud Scheduler Documentation
🔥 Scheduled Cloud Functions from Fireship
🕶️ Awesome List for Google Cloud Platform

--

--

Google Cloud - Community
Google Cloud - Community

Published in Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

Timothy
Timothy

Written by Timothy

Software / DevOps Engineer | Google Developer Expert for Cloud | https://www.codementor.io/@timtech4u