テンプレートを使用して Dataproc クラスタを作成する

このページでは、インラインの Google API Explorer テンプレートを使用して Dataproc API を呼び出し、Dataproc クラスタを作成する方法について説明します。

他の方法でクラスタを作成するには、次に挙げるページをご覧ください。

始める前に

  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 you have the permissions required to complete this guide.

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

  5. Enable the 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

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

  7. Verify that you have the permissions required to complete this guide.

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

  9. Enable the 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

必要なロール

このページの例を実行するには、特定の IAM ロールが必要です。組織のポリシーによっては、これらのロールがすでに付与されている場合があります。ロール付与を確認するには、ロールを付与する必要がありますか?をご覧ください。

ロールの付与については、プロジェクト、フォルダ、組織に対するアクセス権の管理をご覧ください。

ユーザーロール

Dataproc クラスタの作成に必要な権限を取得するには、管理者に次の IAM ロールの付与を依頼します。

サービス アカウント ロール

Compute Engine のデフォルトのサービス アカウントに Dataproc クラスタを作成するために必要な権限を付与するには、プロジェクトの Compute Engine のデフォルトのサービス アカウントに Dataproc ワーカー roles/dataproc.worker)IAM ロールを付与するよう管理者に依頼してください。

クラスタの作成

Dataproc ジョブを実行する前に、ジョブを実行する仮想マシンのクラスタを作成する必要があります。プロジェクトに Dataproc クラスタを作成するには、Google API Explorer の [Try this API] テンプレートに入力して実行します。

  1. リクエスト パラメータ:

    1. projectId を挿入します。
    2. 実際のクラスタが配置されている [region] を指定します(「us-central1」を必要に応じて置き換えます)。このクイックスタートでは、リージョン内のゾーンを指定していないため、Dataproc 自動ゾーン プレースメントによって、クラスタを作成するリージョン内のゾーンが選択されます。
  2. リクエストの本文:

    1. [clusterName] を指定します(「example-cluster」を必要に応じて置き換えます)。ジョブの送信クラスタの更新など、クラスタの操作にはこの名前を使用します。
  3. [EXECUTE] をクリックします。API テンプレートを初めて実行する場合、Google アカウントを選択してログインし、Google API Explorer からアカウントへのアクセスを承認するように求められます。リクエストが成功すると、JSON のレスポンスで、クラスタの作成が保留中であることが示されます。

  4. クラスタが作成されたことを確認するには、 Google Cloud コンソールで [Dataproc クラスタ] ページを開きます。クラスタのプロビジョニングが完了すると、クラスタの [ステータス] には「実行中」と表示されます。

クリーンアップ

このページで使用したリソースについて、 Google Cloud アカウントに課金されないようにするには、次の手順を実施します。

  1. 他のクイックスタートの確認や、他のジョブを実行するためのクラスタが必要ない場合は、API ExplorerGoogle Cloud コンソール、gcloud CLI の gcloud コマンドライン ツール、または Cloud クライアント ライブラリを使用したクイックスタートを使用してクラスタを削除できます。

次のステップ