プロジェクトを設定する

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

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

  1. 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

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

  3. Enable the Google Cloud Dataproc API.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the API

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

  5. フェデレーション ID(連携 ID)を使用するように gcloud CLI を構成します。

    詳細については、連携 ID を使用して gcloud CLI にログインするをご覧ください。

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

    gcloud init

認証情報の必要性について:認証情報が必要になるのは、アプリケーションやブラウザから直接 Managed Service for Apache Spark 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 を作成するをご覧ください。