Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Antes de programar e executar um cron job, configure seu projeto e ambiente do Google Cloudpara o Cloud Scheduler.
Ative a API do Cloud Scheduler
Use as instruções a seguir para criar ou selecionar um projeto Google Cloud
e ativar a API Cloud Scheduler.
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.
Se você for usar um destino HTTP do App Engine, adicione um
aplicativo do App Engine
ao seu projeto. Esse app serve como o local do serviço do Cloud Scheduler e do próprio gerenciador de jobs, que realiza o trabalho associado a um job do Cloud Scheduler e retorna um reconhecimento em resposta.
Se você quiser um gerenciador de jobs do App Engine que não esteja no seu
projeto, selecione um destino HTTP. Nesse caso, não é necessário um app do App Engine no seu projeto.
Console
No console Google Cloud , acesse a página App Engine.
Observe que europe-west e us-central são chamados, respectivamente, europe-west1 e us-central1 nos comandos do Cloud Scheduler.
Depois de definir uma região para o app do App Engine, não é possível mudar
essa escolha.
Não selecione uma conta de serviço. A conta de serviço padrão do App Engine será usada.
Clique em Próxima.
O aplicativo é configurado e criado. Isso pode levar alguns
minutos.
Não faça o download do SDK Cloud. Em vez disso, clique em Farei isso mais tarde.
Você vai ver a mensagem Seu aplicativo do App Engine foi criado.
gcloud
Para criar um app do App Engine, execute o comando
gcloud app create:
gcloudappcreate--region=REGION
Substitua REGION pelo local em que o app é executado. Observe que europe-west e us-central são chamados, respectivamente, europe-west1 e us-central1 nos comandos do Cloud Scheduler.
Depois de definir uma região para o app do App Engine, não é possível mudar
essa escolha.
Para verificar a região de um app, use este comando:
gcloudappdescribe
O locationId indica a região. Por exemplo, locationId: us-central.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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`."]]