cron 작업을 예약하고 실행하기 전에 Cloud Scheduler용 Google Cloud프로젝트와 환경을 설정해야 합니다.
Cloud Scheduler API를 사용 설정
다음 안내에 따라 Google Cloud 프로젝트를 만들거나 선택하고 Cloud Scheduler API를 사용 설정합니다.
콘솔
- 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.
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
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
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. -
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
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
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.
gcloud
- 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.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
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
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace
PROJECT_ID
with a name for the Google Cloud project you are creating. -
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace
PROJECT_ID
with your Google Cloud project name.
-
Verify that billing is enabled for your Google Cloud project.
-
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.gcloud services enable cloudscheduler.googleapis.com
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
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
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace
PROJECT_ID
with a name for the Google Cloud project you are creating. -
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace
PROJECT_ID
with your Google Cloud project name.
-
Verify that billing is enabled for your Google Cloud project.
-
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.gcloud services enable cloudscheduler.googleapis.com
인증 설정
Cloud Scheduler 인증 방법은 API에 액세스하는 데 사용하는 인터페이스와 코드가 실행되는 환경에 따라 다릅니다.
자세한 내용은 Cloud Scheduler에 인증 및 HTTP 대상에 인증 사용을 참고하세요.
App Engine 애플리케이션 추가
App Engine HTTP 대상을 사용하려면 프로젝트에 App Engine 애플리케이션을 추가해야 합니다. 이 앱은 Cloud Scheduler 서비스와 Cloud Scheduler 작업과 연결된 작업을 실행하고 응답으로 확인을 반환하는 작업 핸들러 자체의 위치 역할을 합니다.
프로젝트에 없는 App Engine 작업 핸들러를 사용하려면 대신 HTTP 대상을 선택합니다. 이 경우 프로젝트에 App Engine 앱이 필요하지 않습니다.
콘솔
Google Cloud 콘솔에서 App Engine 페이지로 이동합니다.
App Engine 시작하기 대화상자에서 다음 중 하나를 수행합니다.
이미 App Engine 애플리케이션을 만들었고 App Engine 애플리케이션 생성됨 메시지가 표시되면 이 섹션의 나머지 단계를 건너뛸 수 있습니다.
또는
아직 App Engine 애플리케이션을 만들지 않은 경우 애플리케이션 만들기를 클릭하고 이 섹션의 나머지 단계를 계속 진행합니다.
애플리케이션의 리전을 선택합니다.
europe-west
및us-central
은 Cloud Scheduler 명령어에서europe-west1
및us-central1
로 각각 호출됩니다.App Engine 앱의 리전을 설정한 후에는 변경할 수 없습니다.
서비스 계정을 선택하지 마세요. 기본 App Engine 서비스 계정이 사용됩니다.
다음을 클릭합니다.
애플리케이션이 구성되고 생성됩니다. 몇 분 정도 걸릴 수 있습니다.
Cloud SDK를 다운로드하지 마세요. 나중에를 클릭합니다.
App Engine 애플리케이션 생성됨 메시지가 표시됩니다.
gcloud
App Engine 앱을 만들려면
gcloud app create
명령어를 실행합니다.gcloud app create --region=REGION
REGION
을 앱이 실행되는 위치로 바꿉니다.europe-west
및us-central
은 Cloud Scheduler 명령어에서europe-west1
및us-central1
로 각각 호출됩니다.App Engine 앱의 리전을 설정한 후에는 변경할 수 없습니다.
다음 명령어를 사용하여 기존 앱의 리전을 확인할 수 있습니다.
gcloud app describe
locationId
은 리전을 나타냅니다. 예를 들면locationId: us-central
입니다.