Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Bevor Sie einen Cron-Job planen und ausführen können, müssen Sie Ihr Google Cloud-Projekt und Ihre Umgebung für Cloud Scheduler einrichten.
Cloud Scheduler API aktivieren
Folgen Sie der Anleitung, um ein Google Cloud -Projekt zu erstellen oder auszuwählen und die Cloud Scheduler API zu aktivieren.
Console
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.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
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.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Wie Sie sich bei Cloud Scheduler authentifizieren, hängt von der Schnittstelle ab, über die Sie auf die API zugreifen, und von der Umgebung, in der Ihr Code ausgeführt wird.
Wenn Sie ein App Engine-HTTP-Ziel verwenden möchten, müssen Sie Ihrem Projekt eine App Engine-Anwendung hinzufügen. Diese App dient sowohl als Speicherort des Cloud Scheduler-Dienstes als auch des Job-Handlers selbst, der die mit einem Cloud Scheduler-Job verknüpften Aufgaben ausführt und eine Bestätigung zurückgibt.
Wenn Sie einen App Engine-Job-Handler verwenden möchten, der nicht in Ihrem Projekt enthalten ist, sollten Sie stattdessen ein HTTP-Ziel auswählen. In diesem Fall benötigen Sie keine App Engine-Anwendung in Ihrem Projekt.
Console
Rufen Sie in der Google Cloud Console die Seite App Engine auf.
Führen Sie im Dialogfeld Willkommen bei App Engine einen der folgenden Schritte aus:
Wenn Sie bereits eine App Engine-Anwendung erstellt haben und die Meldung Ihre App Engine-Anwendung wurde erstellt angezeigt wird, können Sie die verbleibenden Schritte in diesem Abschnitt überspringen.
oder
Wenn Sie noch keine App Engine-Anwendung erstellt haben, klicken Sie auf Anwendung erstellen und fahren Sie mit den verbleibenden Schritten in diesem Abschnitt fort.
Beachten Sie, dass europe-west und us-central in Cloud Scheduler-Befehlen als europe-west1 bzw. us-central1 bezeichnet werden.
Nachdem Sie eine Region für die App Engine-App festgelegt haben, können Sie sie nicht mehr ändern.
Wählen Sie kein Dienstkonto aus. Das App Engine-Standarddienstkonto wird verwendet.
Klicken Sie auf Weiter.
Die Anwendung wird konfiguriert und erstellt. Das kann einige Minuten dauern.
Laden Sie das Cloud SDK nicht herunter, sondern klicken Sie auf Ich führe diesen Schritt später aus.
Die Meldung Ihre App Engine-Anwendung wurde erstellt sollte angezeigt werden.
gcloud
Führen Sie den Befehl gcloud app create aus, um eine App Engine-Anwendung zu erstellen:
gcloudappcreate--region=REGION
Ersetzen Sie REGION durch den Standort, an dem die App ausgeführt wird. Beachten Sie, dass europe-west und us-central in Cloud Scheduler-Befehlen als europe-west1 bzw. us-central1 bezeichnet werden.
Nachdem Sie eine Region für die App Engine-App festgelegt haben, können Sie sie nicht mehr ändern.
Sie können die Region einer vorhandenen App mit dem folgenden Befehl überprüfen:
gcloudappdescribe
locationId gibt die Region an. Beispiel: locationId: us-central.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-18 (UTC)."],[],[],null,["# Set up your environment\n\nBefore scheduling and running a cron job, you must set up your Google Cloud\nproject and environment for Cloud Scheduler.\n\nEnable the Cloud Scheduler API\n------------------------------\n\nUse the following instructions to create or select a Google Cloud project\nand to enable the Cloud Scheduler API. \n\n### Console\n\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **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.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Cloud Scheduler API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=cloudscheduler.googleapis.com)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **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.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Cloud Scheduler API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=cloudscheduler.googleapis.com)\n\n\u003cbr /\u003e\n\n### gcloud\n\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **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.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Cloud Scheduler API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=cloudscheduler.googleapis.com)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **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.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Cloud Scheduler API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=cloudscheduler.googleapis.com)\n\n\u003cbr /\u003e\n\nSet up authentication\n---------------------\n\nHow you authenticate to Cloud Scheduler depends on the interface you\nuse to access the API and the environment where your code is running.\n\nFor more information, see\n[Authenticate to Cloud Scheduler](/scheduler/docs/authentication) and\n[Use authentication with HTTP targets](/scheduler/docs/http-target-auth).\n\nAdd an App Engine application\n-----------------------------\n\nIf you are going to use an App Engine HTTP target, you must add an\n[App Engine application](/appengine/docs/standard/managing-projects-apps-billing)\nto your project. This app serves as both the location of the Cloud Scheduler\nservice and of the job handler itself, which performs the work associated with\na Cloud Scheduler job, and returns an acknowledgement in response.\n\nIf you want to have an App Engine job handler that is **not** in your\nproject, you should select an HTTP target instead. In this case, you don't need\nan App Engine app in your project. \n\n### Console\n\n1. In the Google Cloud console, go to the **App Engine** page.\n\n\n [Go to App Engine](https://console.cloud.google.com/appengine/start)\n\n \u003cbr /\u003e\n\n2. In the **Welcome to App Engine** dialog, do one of the\n following:\n\n - If you have already created an App Engine application and there\n is a **Your App Engine application has been created** message displayed,\n you can then skip the remaining steps in this section.\n\n or\n\n \u003cbr /\u003e\n\n - If you haven't created an App Engine application yet, then click\n **Create application** and continue with the remaining steps in this\n section.\n\n3. Select a [region](/appengine/docs/locations) for your\n application.\n\n Note that `europe-west` and `us-central` are called, respectively,\n `europe-west1` and `us-central1` in Cloud Scheduler commands.\n\n After you set a region for the App Engine app, **you can't change\n it**.\n4. Don't select a service account; the default App Engine service\n account is used.\n\n5. Click **Next**.\n\n The application is configured and created. This can take a couple of\n minutes.\n6. Don't download the Cloud SDK; instead, click **I'll do this later**.\n\n You should see a **Your App Engine application has been created** message.\n\n### gcloud\n\n1. To create an App Engine app, run the\n [`gcloud app create`](/sdk/gcloud/reference/app/create) command:\n\n gcloud app create --region=\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e with the\n [location](/appengine/docs/locations) in which the app runs. Note that\n `europe-west` and `us-central` are called, respectively, `europe-west1`\n and `us-central1` in Cloud Scheduler commands.\n\n After you set a region for the App Engine app, **you can't change\n it**.\n2. You can check the region of an existing app with the following command:\n\n gcloud app describe\n\n The `locationId` indicates the region. For example:\n `locationId: us-central`."]]