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

## Enable the Cloud Scheduler API

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

### Console


<br />

### gcloud


<br />

## Set up authentication

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

For more information, see
[Authenticate to Cloud Scheduler](https://docs.cloud.google.com/scheduler/docs/authentication.md.txt) and
[Use authentication with HTTP targets](https://docs.cloud.google.com/scheduler/docs/http-target-auth.md.txt).

## Add an App Engine application

If you are going to use an App Engine HTTP target, you must add an
[App Engine application](https://docs.cloud.google.com/appengine/docs/standard/managing-projects-apps-billing.md.txt)
to your project. This app serves as both the location of the Cloud Scheduler
service and of the job handler itself, which performs the work associated with
a Cloud Scheduler job, and returns an acknowledgement in response.

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

### Console

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


   [Go to App Engine](https://console.cloud.google.com/appengine/start)

   <br />

2. In the **Welcome to App Engine** dialog, do one of the
   following:

   - If you have already created an App Engine application and there
     is a **Your App Engine application has been created** message displayed,
     you can then skip the remaining steps in this section.

     or

     <br />

   - If you haven't created an App Engine application yet, then click
     **Create application** and continue with the remaining steps in this
     section.

3. Select a [region](https://docs.cloud.google.com/appengine/docs/locations) for your
   application.

   Note that `europe-west` and `us-central` are called, respectively,
   `europe-west1` and `us-central1` in Cloud Scheduler commands.

   After you set a region for the App Engine app, **you can't change
   it**.
4. Don't select a service account; the default App Engine service
   account is used.

5. Click **Next**.

   The application is configured and created. This can take a couple of
   minutes.
6. Don't download the Cloud SDK; instead, click **I'll do this later**.

   You should see a **Your App Engine application has been created** message.

### gcloud

1. To create an App Engine app, run the
   [`gcloud app create`](https://docs.cloud.google.com/sdk/gcloud/reference/app/create.md.txt) command:

   ```bash
   gcloud app create --region=REGION
   ```

   Replace `REGION` with the
   [location](https://docs.cloud.google.com/appengine/docs/locations) in which the app runs. Note that
   `europe-west` and `us-central` are called, respectively, `europe-west1`
   and `us-central1` in Cloud Scheduler commands.

   After you set a region for the App Engine app, **you can't change
   it**.
2. You can check the region of an existing app with the following command:

   ```bash
   gcloud app describe
   ```

   The `locationId` indicates the region. For example:
   `locationId: us-central`.