Set up your environment

Before scheduling and running a cron job, you must set up your Google Cloudproject and environment for Cloud Scheduler.

Enable the Cloud Scheduler API

Use the following instructions to create or select a Google Cloud projectand to enable the Cloud Scheduler API.

Console

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.create permission.Learn how to grant roles.
    Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Cloud Scheduler API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enable permission.Learn how to grant roles.

    Enable the API

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.create permission.Learn how to grant roles.
    Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. Enable the Cloud Scheduler API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enable permission.Learn how to grant roles.

    Enable the API

gcloud

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. Install the Google Cloud CLI.

  3. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  4. Toinitialize the gcloud CLI, run the following command:

    gcloudinit
  5. Create or select a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.create permission.Learn how to grant roles.
    Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.
    • Create a Google Cloud project:

      gcloud projects createPROJECT_ID

      ReplacePROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set projectPROJECT_ID

      ReplacePROJECT_ID with your Google Cloud project name.

  6. Verify that billing is enabled for your Google Cloud project.

  7. Enable the Cloud Scheduler API:

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enable permission.Learn how to grant roles.

    gcloudservicesenablecloudscheduler.googleapis.com
  8. Install the Google Cloud CLI.

  9. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  10. Toinitialize the gcloud CLI, run the following command:

    gcloudinit
  11. Create or select a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.create permission.Learn how to grant roles.
    Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.
    • Create a Google Cloud project:

      gcloud projects createPROJECT_ID

      ReplacePROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set projectPROJECT_ID

      ReplacePROJECT_ID with your Google Cloud project name.

  12. Verify that billing is enabled for your Google Cloud project.

  13. Enable the Cloud Scheduler API:

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enable permission.Learn how to grant roles.

    gcloudservicesenablecloudscheduler.googleapis.com

Set up authentication

How you authenticate to Cloud Scheduler depends on the interface youuse to access the API and the environment where your code is running.

For more information, seeAuthenticate to Cloud Scheduler andUse authentication with HTTP targets.

Add an App Engine application

If you are going to use an App Engine HTTP target, you must add anApp Engine applicationto your project. This app serves as both the location of the Cloud Schedulerservice and of the job handler itself, which performs the work associated witha Cloud Scheduler job, and returns an acknowledgement in response.

If you want to have an App Engine job handler that isnot in yourproject, you should select an HTTP target instead. In this case, you don't needan App Engine app in your project.

Console

  1. In the Google Cloud console, go to theApp Engine page.

    Go to App Engine

  2. In theWelcome to App Engine dialog, do one of thefollowing:

    • If you have already created an App Engine application and thereis aYour App Engine application has been created message displayed,you can then skip the remaining steps in this section.

      or

    • If you haven't created an App Engine application yet, then clickCreate application and continue with the remaining steps in thissection.

  3. Select aregion for yourapplication.

    Note thateurope-west andus-central are called, respectively,europe-west1 andus-central1 in Cloud Scheduler commands.

    After you set a region for the App Engine app,you can't changeit.

  4. Don't select a service account; the default App Engine serviceaccount is used.

  5. ClickNext.

    The application is configured and created. This can take a couple ofminutes.

  6. Don't download the Cloud SDK; instead, clickI'll do this later.

    You should see aYour App Engine application has been created message.

gcloud

  1. To create an App Engine app, run thegcloud app create command:

    gcloudappcreate--region=REGION

    ReplaceREGION with thelocation in which the app runs. Note thateurope-west andus-central are called, respectively,europe-west1andus-central1 in Cloud Scheduler commands.

    After you set a region for the App Engine app,you can't changeit.

  2. You can check the region of an existing app with the following command:

    gcloudappdescribe

    ThelocationId indicates the region. For example:locationId: us-central.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.