환경 설정

예약하고 cron 작업을 실행하기 전에 Cloud Scheduler의 Google Cloud 프로젝트와 환경을 설정해야 합니다.

Cloud Scheduler API를 사용 설정

다음 안내에 따라 프로젝트를 만들거나 선택하고 Cloud Scheduler API를 사용 설정합니다. Google Cloud

콘솔

  1. 계정에 로그인하세요. Google Cloud 를 처음 사용하는 경우 Google Cloud 계정을 만들어 실제 시나리오에서 제품이 어떻게 작동하는지 평가하세요. 신규 고객에게는 워크로드를 실행, 테스트, 배포하는 데 사용할 수 있는 $300의 무료 크레딧이 제공됩니다.
  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 the resourcemanager.projects.create permission. Learn how to grant roles.

    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 the serviceusage.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 the resourcemanager.projects.create permission. Learn how to grant roles.

    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 the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

gcloud

  1. 계정에 로그인하세요. Google Cloud 를 처음 사용하는 경우 Google Cloud 계정을 만들어 실제 시나리오에서 제품이 어떻게 작동하는지 평가하세요. 신규 고객에게는 워크로드를 실행, 테스트, 배포하는 데 사용할 수 있는 $300의 무료 크레딧이 제공됩니다.
  2. Google Cloud CLI를 설치합니다.

  3. 외부 ID 공급업체(IdP)를 사용하는 경우 먼저 제휴 ID로 gcloud CLI에 로그인해야 합니다.

  4. gcloud CLI를 초기화하려면, 다음 명령어를 실행합니다.

    gcloud init
  5. 프로젝트를 만들거나 Google Cloud 선택합니다.

    프로젝트를 선택하거나 만드는 데 필요한 역할

    • 프로젝트 선택: 프로젝트를 선택하는 데 특정 IAM 역할이 필요하지 않습니다. 역할을 부여받은 프로젝트를 선택할 수 있습니다.
    • 프로젝트 만들기: 프로젝트를 만들려면 resourcemanager.projects.create 권한이 포함된 프로젝트 생성자 역할 (roles/resourcemanager.projectCreator)이 필요합니다. 역할 부여 방법 알아보기.
    • 프로젝트 만들기: Google Cloud

      gcloud projects create PROJECT_ID

      PROJECT_ID를 만들려는 Google Cloud 프로젝트의 이름으로 바꿉니다.

    • 만든 Google Cloud 프로젝트를 선택합니다.

      gcloud config set project PROJECT_ID

      PROJECT_ID를 프로젝트 이름으로 바꿉니다. Google Cloud

  6. 프로젝트에 결제가 사용 설정되어 있는지 확인합니다 Google Cloud .

  7. Cloud Scheduler API를 사용 설정합니다.

    API 사용 설정에 필요한 역할

    API를 사용 설정하려면 역할 (roles/serviceusage.serviceUsageAdmin)이 포함된 서비스 사용량 관리자 IAM serviceusage.services.enable 권한이 필요합니다. 역할 부여 방법 알아보기.

    gcloud services enable cloudscheduler.googleapis.com
  8. Google Cloud CLI를 설치합니다.

  9. 외부 ID 공급업체(IdP)를 사용하는 경우 먼저 제휴 ID로 gcloud CLI에 로그인해야 합니다.

  10. gcloud CLI를 초기화하려면, 다음 명령어를 실행합니다.

    gcloud init
  11. 프로젝트를 만들거나 Google Cloud 선택합니다.

    프로젝트를 선택하거나 만드는 데 필요한 역할

    • 프로젝트 선택: 프로젝트를 선택하는 데 특정 IAM 역할이 필요하지 않습니다. 역할을 부여받은 프로젝트를 선택할 수 있습니다.
    • 프로젝트 만들기: 프로젝트를 만들려면 resourcemanager.projects.create 권한이 포함된 프로젝트 생성자 역할 (roles/resourcemanager.projectCreator)이 필요합니다. 역할 부여 방법 알아보기.
    • 프로젝트 만들기: Google Cloud

      gcloud projects create PROJECT_ID

      PROJECT_ID를 만들려는 Google Cloud 프로젝트의 이름으로 바꿉니다.

    • 만든 Google Cloud 프로젝트를 선택합니다.

      gcloud config set project PROJECT_ID

      PROJECT_ID를 프로젝트 이름으로 바꿉니다. Google Cloud

  12. 프로젝트에 결제가 사용 설정되어 있는지 확인합니다 Google Cloud .

  13. Cloud Scheduler API를 사용 설정합니다.

    API 사용 설정에 필요한 역할

    API를 사용 설정하려면 역할 (roles/serviceusage.serviceUsageAdmin)이 포함된 서비스 사용량 관리자 IAM serviceusage.services.enable 권한이 필요합니다. 역할 부여 방법 알아보기.

    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 앱이 필요하지 않습니다.

콘솔

  1. Google Cloud 콘솔에서 App Engine 페이지로 이동합니다.

    App Engine으로 이동

  2. App Engine 시작하기 대화상자에서 다음 중 하나를 수행합니다.

    • 이미 App Engine 애플리케이션을 만들었고 App Engine 애플리케이션 생성됨 메시지가 표시되면 이 섹션의 나머지 단계를 건너뛰면 됩니다.

      또는

    • 아직 App Engine 애플리케이션을 만들지 않은 경우 애플리케이션 만들기 를 클릭하고 이 섹션의 나머지 단계를 계속 진행합니다.

  3. 애플리케이션의 리전을 선택합니다.

    europe-westus-central은 Cloud Scheduler 명령어에서 각각 europe-west1us-central1로 호출됩니다.

    App Engine 앱에 리전을 설정한 후에는 변경할 수 없습니다.

  4. 서비스 계정을 선택하지 마세요. 기본 App Engine 서비스 계정이 사용됩니다.

  5. 다음을 클릭합니다.

    애플리케이션이 구성되고 생성됩니다. 몇 분 정도 걸릴 수 있습니다.

  6. Cloud SDK를 다운로드하지 마세요. 대신 나중에를 클릭합니다.

    App Engine 애플리케이션 생성됨 메시지가 표시됩니다.

gcloud

  1. App Engine 앱을 만들려면 gcloud app create 명령어를 실행합니다.

    gcloud app create --region=REGION
    

    REGION을 앱이 실행되는 위치로 바꿉니다. europe-westus-central은 Cloud Scheduler 명령어에서 각각 europe-west1us-central1로 호출됩니다.

    App Engine 앱에 리전을 설정한 후에는 변경할 수 없습니다.

  2. 다음 명령어를 사용하여 기존 앱의 리전을 확인할 수 있습니다.

    gcloud app describe
    

    locationId는 리전을 나타냅니다. 예를 들면 locationId: us-central입니다.