Cloud Scheduler in Google Cloud

Cloud Scheduler in Google Cloud

A complete, plain-English guide to the managed service that wakes your code up on time, every time: nightly reports, hourly clean-ups, Monday-morning emails and anything else that must happen on a schedule, without a single server of your own to babysit.

Think about the alarm clock on your phone. You set it once for seven o’clock, and then you forget about it. Every morning it rings, even if you are asleep, even if you are on holiday in a different time zone. You never check whether the clock is still running, because someone else has made sure it does.

Software needs alarm clocks too. A shop must create a sales report every night. A bank must clear old temporary files every Sunday. A news site must refresh its front page every five minutes. Somebody, or something, has to remember to start each of these jobs at the right moment. In Google Cloud, that something is Cloud Scheduler.

In this guide you will learn what Cloud Scheduler is, how to describe a schedule using a small notation called cron, how a job reaches your code, what happens when things go wrong, how to keep everything secure, and when to choose a different tool instead. Every new word is explained the first time it appears, and every big idea comes with an everyday comparison. Take it one chapter at a time.

1What Cloud Scheduler Is and Why It Exists

Start with the simple idea: some work must start because of the clock, not because someone asked.

Work that follows the calendar

Most software waits for a person to click something or for another program to call it. But a large amount of useful work has no such trigger. Nobody clicks “make the nightly report.” It simply has to happen at two in the morning. This kind of work is called scheduled work or a batch job. Typical examples are backups, report building, data clean-up, cache refreshes, billing runs and health checks.

The old way: cron on a computer

For decades, engineers solved this with a tool called cron, which comes with Linux and similar systems. You write a list of lines, each saying “at this time, run this command.” The computer checks the list every minute and starts whatever is due.

Cron is wonderful and simple, but it has a hidden weakness: it lives on one computer. If that computer is switched off, crashes, is being updated or runs out of disk space, the jobs silently stop. Nobody notices until a customer asks why the report never arrived. If you run two computers to be safe, both may start the same job and create double work. And somebody must patch, secure and monitor that computer forever.

Everyday Analogy

Cron on one computer is like a single night-watchman who has to ring the school bell at every break. If he is ill, there is no bell. Cloud Scheduler is like a professional bell system run by a specialist company, with backup staff, a monitoring room and a promise that the bell will ring on time. You only decide when the bell should ring.

So what is Cloud Scheduler?

Cloud Scheduler is a fully managed, enterprise-grade cron job service in Google Cloud. “Fully managed” means Google runs the servers, keeps them available and fixes them when they fail. You create a job that says three things: when to run (the schedule), what to call (the target) and how to prove who you are (the authentication). At the scheduled moment, Cloud Scheduler sends a request to the target. That is all it does, and that narrow focus is why it is dependable.

Notice what Cloud Scheduler is not. It does not run your code itself. It does not process your data. It simply knocks on a door at the right time, and the thing behind the door, such as a Cloud Run service, a Cloud Run function, a Pub/Sub topic or a web address, does the real work.

A short history

Before Cloud Scheduler, teams on Google Cloud used a feature of App Engine, the older platform, which let you list recurring tasks in a configuration file. That worked only for App Engine applications. Cloud Scheduler appeared around 2018 in beta and reached general availability around 2019, opening the same idea to everything: any HTTP address, any Pub/Sub topic, and through Google’s own APIs, nearly any Google Cloud service. Over the years it gained better authentication options, more control over retries and a larger set of regions.

Managed
No cron server for you to patch or keep alive
Cron
A familiar, compact way to write schedules
At-least-once
Delivery promise you must design for

Why teams choose it

Teams choose Cloud Scheduler because it removes a whole category of chores. There is no server to rent, no operating system to update and no single point of failure. Jobs can be paused, tested with a “run now” button, retried automatically and watched through the same logging and monitoring tools as the rest of Google Cloud.

i
Remember

Cloud Scheduler is the clock, not the worker. Keep the schedule in Cloud Scheduler and the real work in a service built for it, such as Cloud Run.

2The Vocabulary of Scheduled Work

A handful of words appear everywhere in this topic. Learn them once and the rest becomes easy.

Job, schedule and target

A job is the complete instruction stored in Cloud Scheduler. It has a name, a place (region), a schedule that says when, and a target that says what to call. Think of a job as one line in a very reliable calendar.

Cron expression

A cron expression is the compact notation for a schedule. It is made of five fields separated by spaces that stand for minute, hour, day of the month, month and day of the week. It looks cryptic at first, but Chapter 4 shows that only a few patterns cover nearly every real need.

Time zone

A time zone tells Cloud Scheduler which clock to follow. “Nine in the morning” means different moments in Delhi and in London. Every job carries a time zone name from a standard list known as the tz database, such as Asia/Kolkata or America/New_York.

Attempt, retry and deadline

Each time Cloud Scheduler calls the target, that call is an attempt. If the attempt fails, Cloud Scheduler may try again, which is a retry. An attempt deadline is the longest time Cloud Scheduler will wait for an answer before deciding the attempt has failed.

Idempotency

A piece of work is idempotent when doing it twice leaves the same result as doing it once. Setting a thermostat to 22 degrees is idempotent. Adding one to a counter is not. This word matters a great deal because a scheduled job can, in rare cases, be run more than once.

Everyday Analogy

Picture a school timetable on the staff-room wall. Each line is a job: “Period three, Room 12, Mathematics.” The time on the line is the schedule, the room is the target, and the time zone is the school’s clock. The bell system is Cloud Scheduler. It rings the bell, but the teacher in the room does the teaching.

A quick glossary table

TermPlain meaningExample
JobOne stored scheduling instruction“Build the sales report nightly”
ScheduleWhen the job firesEvery day at 2 a.m.
Cron expressionThe notation for a scheduleFive fields of time
TargetWhat gets calledA Cloud Run service address
AttemptOne call to the targetThe 2 a.m. request
RetryA repeat after a failed attemptAnother try 10 seconds later
RegionWhere the job livesasia-south1
Service accountThe identity used to prove who callsscheduler-caller account

Scheduled versus event-driven

One idea trips up many beginners. Scheduled work starts because of time: “every night.” Event-driven work starts because something happened: “a file arrived.” Both are useful, and good systems use each where it fits. If you find yourself scheduling a job every minute just to check “has anything new arrived?”, an event-driven tool such as Eventarc or Pub/Sub is probably a better fit.

•
Good Habit

Ask “is this really about time, or about something happening?” before you reach for a schedule.

3Core Concepts: The Anatomy of a Job

Every Cloud Scheduler job is built from the same few parts. Know them and you can read any job at a glance.

The building blocks

Identity

Name and description

A unique name within the project and region, plus an optional note explaining why the job exists. A clear name saves you at three in the morning.

Placement

Region

The Google Cloud region where the job is stored and run from. Choose one close to your targets and consistent with your data rules.

Timing

Schedule and time zone

A cron expression and a named time zone that together say exactly when the job fires.

Destination

Target type

HTTP, Pub/Sub or App Engine HTTP. This decides how the call is made and what it needs.

Proof

Authentication

A service account and a token type that prove to the target who is calling.

Safety

Retry and deadline settings

How many times to try again, how long to pause between tries and how long to wait for each answer.

The payload

For HTTP targets you can choose the method (such as GET or POST), add headers (small labelled notes sent with the request) and include a body (the content of the request). The body is how you pass a small instruction, for example “build the report for the previous day in format PDF.” For Pub/Sub targets the body becomes the message data, and you can add attributes, which are small labels attached to the message.

Locations matter

Every job lives in a region, which you choose when you create it, and it cannot be moved later. If you need the job elsewhere, you create a new one. Keep jobs in the same region as the services they call when you can, because it shortens the path and makes it easier to follow data-residency rules (laws or company policies about where data may be handled). For App Engine targets, the job’s region must match the region of the App Engine application.

Everyday Analogy

A job is like a delivery order at a flower shop: “Deliver this bouquet (body) to this address (target) every Monday at nine (schedule) in the customer’s local time (time zone), show this security card at the door (authentication), and if nobody answers, come back twice (retry).” Every field has an everyday meaning.

Job states

A job can be enabled, which means it fires on schedule, or paused, which means it exists but does not fire. Pausing is like taking the batteries out of the alarm clock without throwing the clock away. A job can also show a failed state if an update did not apply correctly, in which case you should fix and save it again. Check the current documentation for the exact list of states.

!
Watch Out

Some settings, such as the job name and region, cannot be changed after creation. Plan names carefully, using a pattern such as team, purpose and frequency, so that a list of jobs reads like a clean index.

4Cron Made Easy: Writing Schedules and Handling Time Zones

Cron notation looks like a secret code until you see its five boxes. After that it is just filling in blanks.

The five boxes

A cron expression has five fields, always in the same order. Each field says which values are allowed. A star means “every value.” A number means exactly that value. A comma lists several values. A dash gives a range. A slash gives a step, such as “every fifth.”

PositionFieldAllowed values
1Minute0 to 59
2Hour0 to 23 (24-hour clock)
3Day of the month1 to 31
4Month1 to 12
5Day of the week0 to 6, where 0 is Sunday (7 is often accepted for Sunday too)

Everyday examples

ExpressionPlain meaning
* * * * *Every minute, the fastest allowed rhythm
*/5 * * * *Every five minutes
0 * * * *At the start of every hour
30 2 * * *Every day at 2:30 a.m.
0 9 * * 1-5At 9 a.m. on weekdays, Monday to Friday
0 0 1 * *At midnight on the first day of every month
0 18 * * 5At 6 p.m. every Friday
0 8 1 1 *At 8 a.m. every New Year’s Day
Everyday Analogy

Reading cron is like reading a train timetable header: “Minute, Hour, Day, Month, Weekday.” You fill each column with when the train should leave. A star in a column simply means “any value will do,” like a train that runs on every day of the week.

The famous day-of-month and day-of-week surprise

In classic cron, if you fill in both the day-of-month and the day-of-week fields with something other than a star, the job runs when either matches, not when both match. Someone who writes “the 13th, if it is a Friday” will actually get every 13th and every Friday. If you need a rare combination like that, schedule on the simpler pattern and let your code check the other condition.

Also supported: plain-language intervals

Because Cloud Scheduler grew out of the App Engine cron service, it also understands a friendly style for simple rhythms, such as “every 5 minutes” or “every monday 09:00.” Many teams still prefer standard cron because it is universal, but the friendly style can be easier for newcomers. Check the current documentation for the exact phrases supported.

Time zones and daylight saving

Every job has a time zone. Cloud Scheduler follows that zone’s rules, including daylight saving time, the practice of moving clocks forward and back in some countries. This creates two tricky moments each year in those places. When clocks jump forward, one hour does not exist, so a job set inside that hour may not run at its usual time. When clocks fall back, one hour happens twice, which can make an hourly job appear to run twice.

  • If exactness matters, set the job’s time zone to UTC, which never changes, and convert in your head or in your code.
  • If the job must match a local business time, such as “9 a.m. for the Delhi office,” use the local zone, which for India has no daylight saving.
  • Avoid scheduling important jobs in the hour that moves around during daylight saving changes.

How often is too often?

The smallest rhythm is one minute. There is no way to schedule every second. If you need something faster, that is no longer a schedule, and you should use a queue, a stream or an event-driven design. Also remember that a job does not fire at the exact stroke of the second. It usually starts within a short time after the scheduled moment, so never build logic that depends on second-level precision.

i
Design Tip

Avoid piling every job at midnight or at the top of the hour. Use odd minutes such as 7 past or 23 past, and spread jobs out. Crowds of jobs starting together put needless stress on your systems.

5Where the Call Goes: The Three Target Types

Choosing the target type is the first big design decision. It decides what can be reached, how you prove identity and how failures look.

1. HTTP targets

An HTTP target is the most flexible. Cloud Scheduler sends a web request to an address you give it. You choose the method, headers and body. That address can be a Cloud Run service, a Cloud Run function with an HTTP trigger, a service in another cloud, or a Google Cloud API. In general the address must be reachable over the internet, so if your service lives on a private network, you will usually put a Pub/Sub topic or another bridge in between. Check the current documentation for any newer private-network options.

An attempt counts as successful when the target answers with a success status, which in web language means a code in the 200 range. Other answers count as failures and may be retried.

2. Pub/Sub targets

Pub/Sub is Google Cloud’s messaging service, where a publisher sends a message to a topic and any number of subscribers receive it. With a Pub/Sub target, Cloud Scheduler publishes a message to your topic at the scheduled time. The attempt succeeds when the publish succeeds. From there, subscribers, such as Cloud Run functions or services behind push subscriptions, react.

This type is ideal when several things should happen at the same moment, when the work lives on a private network, or when you want the buffering and retry behaviour that Pub/Sub adds.

3. App Engine HTTP targets

This type sends the request to a service inside an App Engine application in the same project. It is a legacy-friendly option. For new designs, most teams choose HTTP targets pointing at Cloud Run, because Cloud Run is more flexible.

Calling Google APIs directly

A neat trick is that an HTTP target can call a Google Cloud API itself. Because Google’s APIs are just web addresses, a job can start a workflow execution, run a Cloud Run job, start a virtual machine or trigger a Dataflow template, with no code of yours in the middle. For these calls you use a type of token called OAuth, which Chapter 8 explains.

HTTP

Cloud Run service

Call a web endpoint of your own. The most common choice for custom work.

HTTP

Cloud Run function

Run a small piece of code on schedule with minimal setup.

HTTP

Google API call

Start a workflow, a Cloud Run job or a machine with no code in between.

Pub/Sub

Topic publish

Broadcast a tick to many subscribers or cross into a private network.

App Engine

App Engine service

Reach an older App Engine application directly.

HTTP

Outside web address

Ping a partner or another cloud’s endpoint, with authentication as that endpoint requires.

Comparing the target types

TypeBest forSuccess meansWatch out for
HTTPCalling services and Google APIsA 2xx answer within the deadlineTarget must usually be internet-reachable and slow answers count as failures
Pub/SubFan-out and private systemsThe message was publishedSuccess says nothing about whether subscribers did their work
App Engine HTTPExisting App Engine appsA 2xx answerRegion must match the app’s region
!
Watch Out

With a Pub/Sub target, a green tick in Cloud Scheduler only means “the message was posted.” If the subscriber fails later, Cloud Scheduler will not know. You must watch the subscriber side too.

6Architecture and Components

Now put the pieces on one map, so you can see how a scheduled call travels from the clock to your code.

The big picture

The picture is simple on purpose. On the left is the schedule, a cron expression plus a time zone. In the middle is the Cloud Scheduler job, which is a stored record watched by Google’s own scheduling machinery. On the right are the targets. Between the job and the target sits an authentication step that attaches proof of identity to the call.

flowchart LR
  A["Cron Schedule and Time Zone"] --> B["Cloud Scheduler Job"]
  B --> C["Fires at Scheduled Time"]
  C --> D["HTTP Target"]
  C --> E["Pub/Sub Topic"]
  C --> F["App Engine HTTP"]
  D --> G["Cloud Run Service or Function"]
  D --> H["Google API such as Workflows or Cloud Run Jobs"]
  D --> I["Any Public HTTPS Endpoint"]
  E --> J["Subscribers"]
Figure 1. Cloud Scheduler: one job fires on a schedule and reaches an HTTP, Pub/Sub or App Engine target.

Walking through the map

The schedule is only data. It does nothing until Cloud Scheduler’s machinery reads it. That machinery keeps track of the next due time for every job in a region and, when the moment comes, creates an attempt. The attempt builds the request, attaches a token if you asked for one, and sends it to the target. The result, success or failure, is then recorded in the logs and, if it failed, handled according to your retry settings.

The identities involved

Three identities take part, and mixing them up is a very common source of errors.

  • The job’s service account is the identity you choose. Cloud Scheduler uses it to create the token that proves who is calling.
  • The Cloud Scheduler service agent is a Google-managed identity used behind the scenes to do things such as mint the token for your service account.
  • The person who creates the job needs permission to create jobs and to act as the chosen service account.
Everyday Analogy

Imagine a school secretary with a master timetable. At each period, she presses the bell (the job firing), then hands a signed note to the teacher at the door (the token), saying “this really came from the office.” The teacher checks the signature before starting the class. The secretary never teaches; she only rings and signs.

Regional design

Jobs are stored in a region. Google runs the scheduling machinery in a way that tolerates the loss of individual machines, so a single hardware failure does not stop your job. Even so, a whole-region problem is possible in theory. For the most important schedules, some teams create a matching job in a second region that calls a second copy of the service, and design the work so that either copy can run it safely without doing double work.

What Cloud Scheduler does not do

It does not run your code. It does not queue work for later retrying beyond its own retry settings. It does not track whether a previous run is still going. It does not chain steps together, wait for one job to finish before starting another or pass results from one job to the next. Knowing these limits helps you decide which extra pieces you need, such as Workflows for multi-step processes.

•
Good Habit

Draw the full path on paper: schedule, job, token, target, work, result. Most mistakes become visible on the drawing before they show up in production.

7Internal Working: The Life of One Scheduled Run

Follow one nightly run, from the clock reaching two in the morning to the report being written.

The step-by-step journey

1

The clock reaches the scheduled time

Cloud Scheduler’s machinery notices that the job’s next due time has arrived in the job’s own time zone.

2

The next run is planned

The job is given its following due time right away, so the rhythm continues even if this run goes badly.

3

The request is built

Cloud Scheduler assembles the method, address, headers and body, and adds a few identifying headers that name the job and the scheduled time.

4

The token is attached

If authentication is chosen, a short-lived token for the job’s service account is created and added to the request.

5

The target is called

The request is sent. Cloud Scheduler now waits, up to the attempt deadline, for an answer.

6

The target does its work

The Cloud Run service checks the token, starts building the report and answers, ideally quickly, with a success status.

7

The result is recorded

Success ends the run. A failure or a timeout leads to a retry after a growing pause, as long as retries remain.

sequenceDiagram
  participant C as Scheduler Clock
  participant J as Cloud Scheduler Job
  participant T as Token Service
  participant S as Target Service
  C->>J: Scheduled time reached
  J->>T: Request identity token for service account
  T-->>J: Signed token
  J->>S: HTTP request with token and job headers
  S-->>J: Error response 503
  Note over J,S: Wait using backoff then retry
  J->>S: Retry the same request
  S-->>J: Success response 200
  J->>J: Record attempt results in logs
Figure 2. One scheduled run with a failed first attempt and a successful retry.

The identifying headers

For HTTP targets, Cloud Scheduler adds some headers so your service can tell where a request came from. They include a header marking the call as coming from Cloud Scheduler, the name of the job and the scheduled time. The scheduled time is very useful: even if a retry happens a minute later, it carries the same scheduled time as the original attempt. Your code can use it as a natural identifier for “which run is this,” and as a way to spot a repeat.

Waiting for the answer

Cloud Scheduler waits for your target to answer, up to the attempt deadline. The default is a few minutes, and you can raise it to a larger limit, but not without bound. If your work takes longer than the deadline, Cloud Scheduler decides the attempt failed, even though your code may still be running. This leads to a classic problem: the retry starts a second copy of a job that was actually fine. The cure, which Chapter 9 explains, is to reply quickly and let the heavy work continue elsewhere.

Everyday Analogy

Retrying with a pause is like phoning a friend who does not pick up. You do not redial ten times in one second. You wait a little, call again, wait longer, then try once more. The growing pause gives your friend time to find the phone and avoids annoying the whole household.

Why the next run is planned first

Cloud Scheduler decides the next due time before or independently of how the current run ends. The result is that a slow or failed run does not push the schedule back. If your five-minute job takes six minutes, the next run still starts on its five-minute mark. That is good for punctuality, but it is also why overlapping runs can happen, which is a warning you will see again in the anti-patterns chapter.

i
Design Tip

Never assume the job runs exactly once, exactly on the second, or never overlaps with the last run. Design for “at least once, a little late, possibly overlapping.”

8Authentication: Proving Who Is Calling

A target that anyone can call is a target anyone can abuse. Authentication is how Cloud Scheduler proves it is the one calling.

Why authentication matters

Suppose your Cloud Run service creates a report and emails it to customers. If anyone on the internet can call it, a stranger could trigger a thousand reports and a thousand emails. By requiring a signed token, you make sure only the scheduled job, acting as the identity you chose, can trigger it.

Two kinds of token

For your services

OIDC token

An OpenID Connect token is a signed note that says “this is service account X, and this call is meant for audience Y.” Use it when calling Cloud Run, Cloud Run functions or your own services that check tokens.

For Google APIs

OAuth token

An OAuth access token lets the service account call Google Cloud’s own APIs, such as starting a workflow or a virtual machine. Use it for addresses that belong to Google’s API family.

Picking the wrong kind is one of the top reasons a new job fails with an “unauthorized” answer. A simple rule helps: your own service, use OIDC; a Google API, use OAuth.

The audience

An OIDC token carries an audience, which is the intended recipient. For Cloud Run, the audience is usually the service’s address. The service checks that the token was made for it and for no one else. If the audience does not match, the service rejects the call. When the audience is left blank, Cloud Scheduler often defaults to the target address, but check the current documentation for your target type.

The permissions chain

1

Create a dedicated service account

One account for this job or this family of similar jobs, with a clear name such as scheduler-invoker.

2

Give it the right to call the target

For Cloud Run, that is the Cloud Run Invoker role on the specific service. For a Google API, the role that allows that one action.

3

Allow the creator to use it

The person or automation creating the job needs permission to act as that service account, usually through the Service Account User role.

4

Let the service agent mint tokens

Cloud Scheduler’s own service agent must be able to create tokens for the account. This is normally set up for you when the service is enabled, but check it if tokens fail.

Exact role names can change, so follow the current setup guide for your target.

Everyday Analogy

An OIDC token is like a sealed letter with a signature and a named recipient. The receiving office checks the signature and confirms the letter is addressed to it. An OAuth token is like a visitor badge issued for a government building: it lets the holder do specific things inside, and only those.

Do not leave the door open

A tempting shortcut is to allow unauthenticated calls to the Cloud Run service so that “it just works.” This means anyone who learns the address can trigger your work. Keep authentication on, and let only the job’s service account call the service. Your service should also check the token it receives, which Cloud Run does for you when you keep the service private.

!
Watch Out

Never put passwords, API keys or secret tokens in a job’s headers or body. Anyone who can view the job can read them. Keep secrets in Secret Manager and let the target fetch them with its own identity.

9Retries, Failures, Duplicates and Overlapping Runs

This is the chapter that separates a demo from a dependable production job.

The three delivery promises

Messaging and scheduling systems usually offer one of three promises. At-most-once means a run happens zero or one time, so it can be missed but never repeated. At-least-once means one or more times, so it is never dropped on purpose but may repeat. Exactly-once means one time only, which is very hard to guarantee between separate systems. Cloud Scheduler aims for at-least-once. In rare cases, a job may be delivered more than once, so your target should be ready for repeats.

The retry settings

Count

Maximum retry attempts

How many extra tries are allowed after the first failure. The upper limit is small, so retries are meant for glitches, not long outages.

Time

Maximum retry duration

The total time after which Cloud Scheduler stops retrying a run. A value of zero usually means no time limit beyond the count.

Pause

Minimum and maximum backoff

The shortest and longest pause between tries. The pause grows after each failure, up to the maximum.

Growth

Maximum doublings

How many times the pause doubles before it grows by smaller steps. It shapes how quickly waits stretch out.

Defaults are sensible for many jobs, but check the current documentation for exact values and limits. Cloud Scheduler stops retrying once the count or duration limit is reached, whichever comes first, and the run is then recorded as failed until the next scheduled time.

Idempotency: doing the same thing twice safely

Because repeats can happen, make the work idempotent. Many tasks can be made safe with small tricks.

  • Use the scheduled time header as a run identifier and record it. If you see the same one twice, skip the second.
  • Use “create or replace” style writes that end in the same state however many times they run.
  • Name output files after the run’s identifier, so a repeat overwrites the same file instead of making a second.
  • Use a unique key in your database so a second insert is rejected.
Everyday Analogy

Idempotency is like an elevator button. Pressing “floor 5” again and again does not send the elevator to floor 5 five times. The system understands you want one result. A good scheduled job behaves like that button.

Failures and what happens next

Short glitch

Target briefly unavailable

Retries with growing pauses usually succeed once the target recovers.

Slow target

Answer arrives after the deadline

Cloud Scheduler records a failure and retries, even though your code may have finished. This is the classic source of duplicate runs.

Long outage

Target is down for hours

Retries stop after their limits, the run is marked failed, and nothing re-queues it. Plan a way to catch up.

Bad request

Wrong token or address

Every attempt fails the same way. Fix the job rather than waiting for retries to help.

Overlapping runs

Cloud Scheduler does not wait for the previous run to finish before the next one is due. If your job takes longer than the gap between runs, two copies can work at once and step on each other, for example both rewriting the same file. Guard against this with a lock, which is a marker saying “someone is already doing this,” kept in a database or storage object. A run that finds the lock held simply exits quickly with success.

Catching up after a missed run

If a run is lost to a long outage, Cloud Scheduler does not make it up later. The best protection is to make each run process “everything since the last successful run” instead of “only the last hour.” Then a missed run is quietly recovered by the next one.

!
Watch Out

Do not answer with success before the work is safely recorded. If you reply “done” and then crash, Cloud Scheduler believes everything is fine and will not try again.

10Running and Managing Jobs Day to Day

Creating a job is the easy part. Living with a hundred jobs is the real skill.

The everyday operations

1

Create and test

Create the job, then use “force run” to fire it immediately instead of waiting for the schedule. Check the target’s logs to confirm the call worked.

2

Pause

Stop a job from firing without deleting it. Perfect for maintenance windows and holidays.

3

Resume

Start the job again. It continues from its next scheduled time and does not rush to catch up on missed ones.

4

Update

Change the schedule, target, body or retry settings. Changes apply to future runs.

5

Delete

Remove the job completely when it is no longer needed. Remove old jobs, because forgotten jobs still run and still cost money.

Keeping jobs under control with code and review

When a team has many jobs, clicking in a console becomes risky because nobody can see who changed what. A better habit is infrastructure as code, which means describing your jobs in version-controlled files and letting a tool such as Terraform create them. Changes then go through review, and you can recreate the whole setup in a new project in minutes. This guide gives no code, but the idea is worth knowing: jobs are configuration, and configuration deserves the same care as software.

Separate environments

Keep test and production schedules apart. A test project can run its jobs every minute to prove they work, while production runs them nightly. Never let a test job point at a production target by mistake. Using different projects, different service accounts and clear name prefixes such as test- and prod- prevents such accidents.

Everyday Analogy

Managing jobs is like managing a school timetable. Adding a lesson is easy. The hard part is knowing, a year later, why Room 12 is booked at 3 p.m., who owns it, and whether it can be cancelled. Names and descriptions are the notes that keep the timetable understandable.

Ownership and documentation

Every job should answer four questions in its description: what it does, who owns it, what breaks if it stops and where its runbook (a short step-by-step guide for fixing it) lives. A job without an owner is a job that will fail quietly for months.

i
Design Tip

Review your job list every quarter. Delete what is dead, pause what is unsure and write an owner next to everything that remains.

11Security: Identities, Permissions and Safe Habits

A scheduler holds the keys to start powerful actions at any hour of the night, so every lock matters.

Identity and Access Management (IAM)

IAM is Google Cloud’s permission system. It answers the question, “Who is allowed to do what to which resource?” Permissions are grouped into roles, and roles are given to principals, such as people and service accounts. A service account is an identity for a program rather than a person.

Two separate questions

Security around Cloud Scheduler has two halves that are easy to confuse.

  • Who can manage jobs? This is about people and automation who create, change, pause or run jobs. Give the job-management roles only to the small group that needs them.
  • What can a job do when it fires? This is about the service account the job uses. It should hold only the exact permission needed to call its target.

The danger of power by proxy

Here is a subtle risk. Anyone who can create a job and act as a powerful service account can make that account call anything it is allowed to call, at any time. In effect, the ability to create jobs plus the ability to use a strong identity equals the strong identity’s power. This is why the permission to “act as” a service account must be handed out carefully, and why each job should use a service account with the narrowest possible reach.

Everyday Analogy

Picture a building with badge doors. The cleaning company’s badge opens only the supply closets and the lobby. Even if someone steals the cleaner’s badge, they cannot enter the server room. A job’s service account should be that badge: it opens exactly the doors it needs, and no more.

Least privilege

The principle of least privilege says to give every identity only the permissions it truly needs. Create one service account per job or per group of similar jobs. A job that only needs to publish to one Pub/Sub topic should be allowed to publish to that topic and nothing else. If one account is compromised or misused, the damage stays small.

Protect the target as well

  • Require authentication on the target and let only the job’s service account call it.
  • Verify the token if your service is not on Cloud Run, including its audience and issuer.
  • Do not trust the request body blindly. Validate it as you would any other input, because anyone who can edit a job can change the body.
  • Keep secrets out of jobs. Headers and bodies are stored as plain configuration and can be seen by anyone with view permission.

Audit and control

Google Cloud keeps an audit trail of who created, changed or deleted jobs. Watch for unexpected changes, such as a new job calling an unknown address. Organization policies, which are company-wide rules, can also limit which service accounts may be used or where resources may live.

Network and data protection

Data is encrypted in transit and at rest by default. HTTP targets generally need to be reachable from Google’s network, so protect them with authentication rather than by hiding them. For private services, a Pub/Sub topic or another controlled bridge is a common pattern. Check the current documentation for newer private-connectivity options and for compatibility with VPC Service Controls, which draw a protective boundary around Google Cloud services.

i
Security Habit

Once a quarter, list every job, its service account and its target. If you cannot explain why a job exists, pause it and find out.

12Monitoring, Logging and Metrics

A scheduler works quietly. That is a gift when it works and a trap when it fails, because nobody notices silence.

Three questions to answer

Good monitoring of scheduled work answers three simple questions. Did the job fire on time? Did the target accept and complete the work? Was the result what the business expected? Every dashboard and alert should map to one of these.

Where to look

Logs

Cloud Logging

Cloud Scheduler writes a log entry for each attempt, showing the job name, the target and whether the attempt succeeded or failed, with the target’s answer code.

Metrics

Cloud Monitoring

Counts of attempts and their outcomes let you chart trends and build alerts on failure rates.

Target side

Your service’s logs

The target’s own logs show what it did with each call. Include the scheduled time in every line so one run can be followed end to end.

Pub/Sub side

Subscription health

For Pub/Sub targets, watch the age of the oldest unhandled message on the subscription. It reveals trouble that Cloud Scheduler cannot see.

Alerts worth having

  • A rise in failed attempts for any production job.
  • A job that has failed several runs in a row.
  • The absence of a successful run for longer than expected, called a dead-man’s switch. If a daily job has not succeeded in twenty-six hours, someone should be told.
  • Target latency growing close to the attempt deadline, a warning of duplicate runs to come.
Everyday Analogy

A dead-man’s switch is like a night guard who must press a button every hour. If the button is not pressed, an alarm sounds. You are not waiting for a bang; you are listening for a missing sound. Scheduled jobs need that kind of alarm because a job that never ran leaves no error message at all.

The business check

A green tick from Cloud Scheduler only says the call was made and answered. It does not say the report is correct or the table has fresh data. For important jobs, add a business-level check: after the nightly load, a small query confirms that today’s rows exist, and an alert fires if they do not.

Correlation: following one run

When something goes wrong at 3 a.m., you will want to ask, “What happened to the run scheduled for 2 a.m.?” That is only easy if you planned for it. Put the job name and scheduled time into every log line of the target, and pass them along to any next service you call. With these two habits, a single search tells the full story.

!
Watch Out

Failure alerts alone are not enough. A paused job, a deleted job or a job pointing at the wrong place can all fail silently. Always alert on missing success too.

13Performance, Reliability, Limits and Cost

What can you count on, what can you not, and what does it cost to keep a schedule running?

Timing precision

Cloud Scheduler is built for minute-level schedules. A job normally starts within a short time of its due moment, but not at an exact second, and brief delays are possible under load. If a task needs to happen at an exact instant, such as a market opening to the second, do not depend on a scheduler alone. Start a little early and have your code wait for the exact moment.

Reliability

The scheduling machinery is a managed, replicated service, so the loss of single machines does not stop it. Even so, treat three failure types as normal: the target is down, the network is briefly unreliable, and a run is delivered twice. A reliable design assumes all three and has a plan for each.

Limits to be aware of

Cloud Scheduler has quotas, which are caps on things like the number of jobs in a project and the allowed retry settings. The shortest rhythm is one minute. The longest attempt deadline is bounded. A job’s body has a size limit. These numbers change over time, so read the current quotas page before designing at large scale, and request an increase well before you need it.

1 minute
Shortest rhythm a schedule can have
Seconds
Typical start delay, not an exact-second promise
Quotas
Caps on jobs and settings, check the current page

The thundering herd

Suppose a hundred jobs are all set to fire at midnight. At 00:00, a hundred requests hit your systems at once, databases strain and everything slows down. This pile-up is called a thundering herd. Spread schedules across minutes, use odd minutes rather than round ones, and add a small random wait at the start of heavy jobs, known as jitter.

Everyday Analogy

A thundering herd is like every classroom in a school letting out at the same second. The corridors jam. If bells rang a few minutes apart, each class would walk through freely. Staggering jobs is the same kindness to your systems.

Cost

Cloud Scheduler is billed mainly per job per month, with a small free allowance, rather than per run. This makes it very cheap compared with keeping a virtual machine on just to run cron. Pricing can change, so read the current pricing page. Remember the costs around it: the target’s run time on Cloud Run, Pub/Sub messages, log volume and any downstream database calls. A schedule that fires every minute and starts heavy work will cost far more in the target than in the scheduler.

Scale in plain numbers

Because every job is its own record, Cloud Scheduler suits tens or hundreds of recurring tasks, not millions of one-off timers. If your application needs a separate reminder for each of a million users, a job per user is the wrong tool. Cloud Tasks, which can schedule an individual task for a future time, or a database-driven design, is a better fit.

i
Design Tip

One job that starts a worker which then processes many items is almost always better than many jobs that each process one item.

14Advantages, Disadvantages and Trade-offs

No tool is perfect. A fair look at both sides helps you decide when Cloud Scheduler is the right fit.

Advantages

  • Fully managed, so no cron server to patch, secure or keep alive.
  • Familiar cron notation and clear time zone support.
  • Three target types, and can call Google APIs directly with no code in between.
  • Built-in retries with backoff and an attempt deadline.
  • Authentication with identities you control.
  • Pause, resume and force-run make testing and maintenance easy.
  • Integrated logging and monitoring, and very low cost per job.

Disadvantages

  • At-least-once delivery means you must handle duplicates.
  • No built-in protection against overlapping runs.
  • No catch-up for missed runs after a long outage.
  • Minute-level precision, not exact-second.
  • Does not chain steps, wait for results or pass data between jobs.
  • HTTP targets usually must be reachable over the internet.
  • One job per recurring task, so it is a poor fit for huge numbers of timers.

The big trade-offs in plain words

Simplicity against control. Cloud Scheduler hides the machinery, which makes it simple. In return, you cannot tune it the way you could tune your own scheduler software.

Reliability against exactness. The service rings the bell dependably, but it does not promise the exact second or that the bell rings only once.

Narrow focus against power. It only fires requests. For multi-step processes, dependencies, waiting and complex retries, you add Workflows or a full orchestrator.

Convenience against safety. Pointing a job straight at a powerful Google API saves code, but it also puts a lot of power in a service account. Use the narrowest role you can.

A good schedule is a promise to ring the bell. A good design is a promise that nothing breaks if the bell rings twice.

15Design Patterns for Scheduled Work

A pattern is a proven way to solve a common problem. These are the ones you will use again and again.

Useful patterns

Pattern

Scheduler to Cloud Run

The job calls an authenticated Cloud Run service that does the real work. Simple, clear and the most common design.

Pattern

Fan-out through Pub/Sub

One tick is published to a topic and many subscribers each do their own task. Adding a new task needs no change to the schedule.

Pattern

Scheduler to Workflows

The job starts a workflow that runs several steps in order, with waits and error handling, which Cloud Scheduler cannot do alone.

Pattern

Scheduler to a Cloud Run job

For long batch work, the job calls the Cloud Run API to start a Cloud Run job, which can run far longer than a web request.

Pattern

Watermark processing

Each run handles everything since the last recorded success. A missed run is then recovered by the next one.

Pattern

Lock and skip

A run takes a lock before working. If a lock exists, it exits at once, stopping overlaps.

flowchart LR
  S["Cloud Scheduler Job at 02:07"] --> P["Pub/Sub Topic nightly-tick"]
  P --> A["Cleanup Function"]
  P --> B["Report Builder Service"]
  P --> C["Cache Warmer"]
  B --> D["Report Stored in Cloud Storage"]
Figure 3. Fan-out: one scheduled tick is published once and several subscribers react independently.
Everyday Analogy

Fan-out is like a school principal ringing one bell. Every classroom hears it and does its own thing: one class packs up, another goes to lunch and the cleaners start work. The principal does not walk to each room, and a new classroom needs no change to the bell.

Time-window design

Do not write code that says “process data from one hour ago until now.” If a run is late, retried or skipped, the window drifts and data is missed or counted twice. Use the scheduled time to define the window precisely: the 02:00 run handles the data from 01:00 to 02:00, whenever it actually starts. Then every retry processes the same window and gives the same answer, which is idempotency in action.

Heartbeat jobs

A heartbeat job does almost nothing except prove the system is alive. It might write a timestamp to a database every five minutes. A separate alert fires if the timestamp becomes stale. This is a cheap way to watch not only the scheduler but the whole path behind it.

•
Good Habit

Define each run by its scheduled time, not by “now.” That one habit prevents a large share of scheduling bugs.

16Anti-patterns to Avoid

An anti-pattern is a tempting mistake that causes trouble later. These are the most common ones.

ANTI-PATTERN 01 · THE OVERLAPPING RUNSAvoid
What it looks like

A job fires every five minutes. The work sometimes takes eight minutes. Nothing stops the next run from starting while the first is still going.

Why it hurts

Two copies edit the same files or rows at the same time, causing duplicate records, corrupted files or double charges.

What to do instead

Use a lock so a second run exits at once, or lengthen the schedule, or hand heavy work to a Cloud Run job and have the scheduled call only start it.

sequenceDiagram
  participant S as Scheduler
  participant R1 as First Run
  participant R2 as Second Run
  S->>R1: Start heavy job
  Note over R1: Job takes 8 minutes
  S->>R2: Start next scheduled run after 5 minutes
  Note over R1,R2: Both runs touch the same data at once
  R1-->>S: First run finishes
  R2-->>S: Second run finishes
Figure 4. Overlapping runs: the next run starts before the previous one has finished.
ANTI-PATTERN 02 · THE SLOW ANSWERAvoid
What it looks like

The target does thirty minutes of work before replying, but the attempt deadline is far shorter.

Why it hurts

Cloud Scheduler marks the attempt as failed and retries, so the same long job starts again, and again. Costs rise and data may be duplicated.

What to do instead

Reply quickly after accepting the work, and let a queue, a Cloud Run job or a workflow carry on in the background.

ANTI-PATTERN 03 · THE SECRET IN THE JOBAvoid
What it looks like

A password or API key is pasted into a header or body of the job so that the target “just works.”

Why it hurts

Anyone who can view the job can read the secret, and it may spread into logs and copies of configuration.

What to do instead

Use a service account and a signed token, and store real secrets in Secret Manager for the target to fetch.

ANTI-PATTERN 04 · THE MIDNIGHT STAMPEDEAvoid
What it looks like

Dozens of jobs are all set to fire at exactly midnight, or at the top of every hour.

Why it hurts

Databases, APIs and services are hit all at once, producing slowdowns and failures that vanish a few minutes later and are hard to explain.

What to do instead

Spread schedules over different minutes, and add a little random delay at the start of heavy jobs.

ANTI-PATTERN 05 · THE POLLING CLOCKAvoid
What it looks like

A job runs every minute only to check whether a file has arrived or a record has changed.

Why it hurts

Most runs find nothing, work is delayed up to a minute and costs grow for no reason.

What to do instead

Use an event-driven tool such as Eventarc or a Pub/Sub trigger so the system reacts the moment something happens.

17Best Practices and Common Mistakes

A short checklist you can use on your next build.

Best practices

1

Keep the job thin

Let Cloud Scheduler only fire the request. Put the real work in Cloud Run, a Cloud Run job or a workflow.

2

Make the work idempotent

Assume repeats and design so they do no harm, using the scheduled time as the run identifier.

3

Reply fast, work safely

Accept the call, record the work durably, hand off heavy lifting and answer within the deadline.

4

Guard against overlap

Use a lock or a state record so two runs never fight over the same data.

5

Use dedicated, minimal identities

One service account per job group with only the roles it needs, and authentication always on.

6

Pick time zones on purpose

Use UTC for exactness, a local zone for business times, and avoid the daylight saving gap hour.

7

Stagger schedules

Spread jobs over odd minutes and add jitter to heavy ones.

8

Alert on silence as well as errors

A job that never ran leaves no error. Watch for missing success.

9

Describe and own every job

Write a purpose, an owner and a runbook link in each description, and manage jobs through version-controlled configuration.

Common mistakes

Mistake

Wrong token type

OIDC used for a Google API, or OAuth used for Cloud Run, and every call returns “unauthorized.”

Mistake

Missing permissions

The service account lacks the invoker role, or the creator cannot act as the account. Check IAM first when calls fail.

Mistake

Wrong audience

The token’s intended recipient does not match the target, so the service rejects it.

Mistake

Time zone confusion

The job runs in UTC while the team expects local time, so the report arrives hours off.

Mistake

Forgotten jobs

Old jobs keep running and costing money after the project they served has ended.

Mistake

Test job pointing at production

A job meant for a trial quietly writes into live data.

A simple troubleshooting order

When a job does not do what you expect, check in this order. First, is the job enabled and is its schedule and time zone what you intended? Second, does the log show that attempts were made, and what answer code came back? Third, if the answer is “unauthorized” or “forbidden,” check the token type, audience and roles. Fourth, if the answer is “not found,” check the address and region. Fifth, if the answer is a server error, look at the target’s own logs. Sixth, use “force run” to repeat the call on demand while you watch. Following the same path each time turns panic into routine.

18Real-World Usage Scenarios

These typical situations show how companies of many kinds use scheduled work on Google Cloud. They are illustrative patterns, not accounts of any one company’s private setup.

Online retail: nightly reports and stock checks

At 2:07 each morning, a job calls a Cloud Run service that totals yesterday’s orders, builds a report and stores it in Cloud Storage. Another job at a different minute refreshes stock levels for the website. The report job uses the scheduled time to pick yesterday’s date, so a retry produces the identical file.

Banks and finance teams: reconciliation and housekeeping

Each evening a job starts a workflow that fetches the day’s transactions, compares them with the ledger and raises a ticket if they differ. A weekly job removes expired temporary files, and a monthly job produces statements. Each job has its own narrow service account, and a dead-man’s switch alert warns if the evening run has not succeeded.

Media sites: refreshing content

A news or video site may refresh its front page data every few minutes. A scheduled call regenerates a cached copy, and a Pub/Sub fan-out also tells a search indexer and a recommendation service to update. If one subscriber fails, the others are unaffected.

Data and analytics teams: loading and exporting

A job starts a Cloud Run job that pulls partner data, loads it into BigQuery and writes a summary table. A second job exports a nightly snapshot to storage. Because every run handles “everything since the last successful load,” a missed night is recovered the next night.

Cost-conscious teams: switching test machines off

Development virtual machines are expensive when idle. One job stops them at 8 p.m. through a Google API call using an OAuth token, and another starts them at 8 a.m. on weekdays. Months of saved hours add up to real money, with no code written for the switching.

Software teams: security and compliance sweeps

A weekly job calls a service that lists storage buckets, checks that none is public and reports exceptions. Another checks that certificates are not close to expiry. These checks are cheap, boring and exactly what a scheduler is for.

Service owners: heartbeats and uptime pings

A job calls a service’s health address every few minutes and writes the result. A separate alert fires if the checks stop arriving, giving a simple second opinion on whether the whole path from clock to service still works.

i
Pattern in Common

In every case the scheduler only starts the work, the work is safe to repeat, and someone is told if the expected run never happens.

19Cloud Scheduler Compared with Nearby Tools

Google Cloud has several services that start work. Knowing the differences prevents using the wrong one.

ToolMain jobUse it when
Cloud SchedulerStarts work on a clock or calendarSomething must happen every hour, night or week regardless of events
EventarcRoutes events to destinationsYou want to react to something that happened, such as a file arriving
Pub/SubMessaging backbone with topics and subscriptionsYou need to broadcast messages to many receivers or buffer work
Cloud TasksQueue of individual tasks with rate control and optional future timeYour code hands off specific jobs, possibly for a later moment, such as per-user reminders
WorkflowsRuns ordered steps across servicesA process has several steps, waits and error paths
Cloud ComposerManaged Apache Airflow for complex pipelinesYou have many dependent tasks with detailed scheduling, backfills and monitoring
BigQuery scheduled queriesRuns a query on a schedule inside BigQueryThe whole job is one query and the results stay in BigQuery
Cron on a virtual machineSelf-managed cronRarely; only when you must run on a specific machine you already manage
flowchart TD
  Q["What starts your work?"] --> A{"A clock or calendar?"}
  A -->|"Yes"| B["Cloud Scheduler"]
  A -->|"No"| C{"Something happened?"}
  C -->|"Yes"| D["Eventarc or Pub/Sub"]
  C -->|"No"| E{"One delayed task from your own code?"}
  E -->|"Yes"| F["Cloud Tasks with a schedule time"]
  E -->|"No"| G["Workflows or Cloud Composer for multi-step flows"]
Figure 5. A quick decision path for choosing between Google Cloud’s work-starting tools.

Scheduler and Workflows together

These two are friends, not rivals. Cloud Scheduler decides when, and Workflows decides what happens next. A job starts a workflow execution on schedule, and the workflow carries out the steps, waits, retries and error handling. This pairing keeps the scheduler simple and the process visible.

Scheduler and Cloud Tasks

Cloud Scheduler is for recurring jobs you configure ahead of time. Cloud Tasks is for work your application creates on the fly, such as “send this user a reminder in 20 minutes.” If the schedule is data that changes per customer, use Cloud Tasks or a database, not a job per customer.

If you know other clouds

Readers who know other clouds may find a loose comparison helpful: Cloud Scheduler plays a role similar to the scheduled-rule and scheduler services found on other major clouds. The match is not exact, so rely on Google Cloud’s documentation for details.

20Designing Your First Solution: A Walkthrough

Let us put everything together by designing, on paper, a nightly sales-report flow for a small online shop.

Step 1: Write the story in one sentence

“Every night at about 2 a.m. India time, build yesterday’s sales report, store it, and email the finance team, and never email the same report twice.” This sentence names the time, the action, the result and an important rule.

Step 2: Pick the schedule and time zone

The business thinks in Indian time, which has no daylight saving, so the job uses Asia/Kolkata. To avoid the midnight stampede, the job is set for a few minutes past two, not exactly on the hour. The expression means “minute 7, hour 2, every day.”

Step 3: Choose the target

The report takes a few minutes to build, which is longer than a comfortable web answer. So the job calls a Google API to start a Cloud Run job, which can run for a long time, rather than a web service that would have to answer quickly. Because this is a Google API, the job uses an OAuth token.

Step 4: Set identities

A dedicated service account, named for this job only, receives just the permission to start that one Cloud Run job. The Cloud Run job itself has a different service account that can read the orders database and write to one storage bucket.

flowchart LR
  S["Cloud Scheduler Job at 02:07 India time"] --> R["Cloud Run Job builds report"]
  R --> D["Orders Database read only"]
  R --> B["Report File in Cloud Storage"]
  R --> M["Email to Finance Team"]
  R --> L["Cloud Logging and Alert on Missing Success"]
Figure 6. A nightly report flow: the scheduler only starts the job, and the job does the work.

Step 5: Protect against the known traps

Trap

Duplicate emails

The run identifier is the report date. A table records “report for this date sent.” A repeat sees the record and skips the email.

Trap

Overlap

The Cloud Run job takes a lock for the date before starting. A second start exits quickly.

Trap

Missed night

Each run builds any dates not yet marked complete, so a missed night is caught up the following night.

Trap

Secret leakage

No password lives in the job. The database credentials come from Secret Manager.

Step 6: Plan the watching

An alert fires if the job logs failed attempts, and a dead-man’s switch fires if no successful report is recorded for twenty-six hours. A small business check confirms that yesterday’s order total in the report matches a quick count from the database.

The design checklist

QuestionOur answer in this example
What starts the work?The clock, nightly
Which time zone?Asia/Kolkata
Which minute?A few minutes past the hour, to avoid the stampede
Which target?An HTTP call to the API that starts a Cloud Run job
Which token?OAuth, because it is a Google API
How are repeats handled?Report date recorded, so a repeat is skipped
How is overlap prevented?A per-date lock
How is a missed run recovered?Each run completes any unfinished dates
How do we notice trouble?Failure alert plus a missing-success alert
Everyday Analogy

Designing a scheduled flow before building it is like drawing a floor plan before building a house. Moving a wall on paper costs a pencil stroke. Moving a wall after the bricks are laid costs far more. The checklist above is your floor plan.

•
Take This With You

The same six steps suit almost any scheduled design: tell the story, choose the schedule, choose the target, set identities, guard the traps and plan the watching.

21Frequently Asked Questions

Quick answers to the questions that come up most often.

Q1Is Cloud Scheduler the same as cron?

It uses the same schedule notation, but it is a managed service. There is no machine for you to run, and it adds retries, authentication, logging and monitoring that plain cron does not have.

Q2Does Cloud Scheduler run my code?

No. It only sends a request or publishes a message at the scheduled time. Your code runs in the target, such as Cloud Run or a Cloud Run function.

Q3Can a job run twice for the same schedule?

Yes, in rare cases, and also through retries after a slow or failed answer. Design the work to be idempotent.

Q4What is the shortest interval I can use?

One minute. For anything faster, use an event-driven or streaming design instead.

Q5What happens if my target is down at the scheduled time?

Cloud Scheduler retries according to your retry settings. If all retries fail, the run is recorded as failed and the job waits for its next scheduled time. It does not make up the missed run later.

Q6Does the next run wait for the previous one to finish?

No. Runs are scheduled by the clock, so they can overlap if work takes longer than the gap. Use a lock to prevent trouble.

Q7Which token should I use, OIDC or OAuth?

Use OIDC when calling your own services such as Cloud Run or Cloud Run functions. Use OAuth when calling Google Cloud APIs.

Q8How do I test a job without waiting?

Use the force-run option to fire the job immediately, then check the target’s logs and the job’s attempt log.

Q9Can I call a private service inside my VPC?

HTTP targets generally need to be reachable from the internet. A common approach is to publish to Pub/Sub and let a subscriber inside your network do the work. Check the current documentation for newer private-connectivity options.

Q10How do daylight saving changes affect my job?

Jobs follow their time zone’s rules, so an hour may be skipped or repeated on change days in zones that use daylight saving. Use UTC, or avoid the changing hour, for important jobs.

Q11Is it expensive?

Pricing is mainly per job per month with a small free allowance, which is usually far cheaper than a machine running cron. Pricing can change, so read the current pricing page. Also count the cost of whatever the job starts.

Q12Should I create one job per customer?

Usually not. Jobs suit a modest number of recurring tasks. For large numbers of per-user timers, use Cloud Tasks or a database-driven approach.

Q13How do I know a scheduled job silently stopped?

Add an alert on the absence of a successful run for longer than expected, sometimes called a dead-man’s switch, in addition to alerts on failures.

22Summary and Key Takeaways

The whole guide in one place.

Key Takeaways

  • Cloud Scheduler is a managed clock. It fires HTTP requests, Pub/Sub messages or App Engine calls on a cron schedule, and leaves the real work to services built for it.
  • Know your cron and your time zone. Five fields describe almost every schedule. Choose UTC or a local zone deliberately and avoid the daylight saving gap hour.
  • Design for at-least-once delivery. Expect repeats and overlaps, use the scheduled time as the run identifier, and add locks and idempotent writes.
  • Reply fast and work safely. Stay inside the attempt deadline, hand long work to Cloud Run jobs, queues or workflows, and never reply success before the work is recorded.
  • Prove identity the right way. Use a dedicated least-privilege service account, OIDC for your services, OAuth for Google APIs, and never put secrets in a job.
  • Watch for silence. Alert on failures and also on missing successes, and add business-level checks for important results.
  • Pick the right tool. Use Cloud Scheduler for time, Eventarc or Pub/Sub for events, Cloud Tasks for individual delayed tasks and Workflows for multi-step processes.