プロジェクトを設定する

このドキュメントでは、 Google Cloud プロジェクトと Compute Engine 仮想マシン(VM)を設定する方法について説明します。

Google Cloud プロジェクトを設定する

  1. Google Cloud アカウントにログインします。 Google Cloudを初めて使用する場合は、 アカウントを作成して、実際のシナリオでの Google プロダクトのパフォーマンスを評価してください。新規のお客様には、ワークロードの実行、テスト、デプロイができる無料クレジット $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 Google Cloud Dataproc 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. Google Cloud CLI をインストールします。

  6. 外部 ID プロバイダ(IdP)を使用している場合は、まず連携 ID を使用して gcloud CLI にログインする必要があります。

  7. gcloud CLI を初期化するには、次のコマンドを実行します。

    gcloud init
  8. 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

  9. Verify that billing is enabled for your Google Cloud project.

  10. Enable the Google Cloud Dataproc 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

  11. Google Cloud CLI をインストールします。

  12. 外部 ID プロバイダ(IdP)を使用している場合は、まず連携 ID を使用して gcloud CLI にログインする必要があります。

  13. gcloud CLI を初期化するには、次のコマンドを実行します。

    gcloud init

認証情報の必要性について:認証情報が必要になるのは、アプリケーションやブラウザから直接 Dataproc API を呼び出すことができるようにする場合のみです。 Google Cloud コンソールまたは Google Cloud CLI を使用してクラスタを作成、管理し、ジョブを送信する場合は、gcloud init コマンドを使用して SDK にログインするだけで済みます。

省略可: VM を設定する

Compute Engine 仮想マシン(VM)インスタンスから gcloud CLI を実行する場合は、 Google Cloud サービスにアクセスするようにこの VM を設定する必要があります。

VM が正しく設定されているかどうかをテストするには、gcloud compute instances describe YOUR_VM_INSTANCE_NAME をコマンドラインから実行します。https://www.googleapis.com/auth/cloud-platform スコープを含むサービス アカウントが一覧表示される必要があります。VM を設定する方法について詳しくは、ユーザー管理のサービス アカウントを使用する VM を作成するをご覧ください。