テンプレートを使用して Dataproc クラスタを作成する
このページでは、インラインの Google API Explorer テンプレートを使用して Dataproc API を呼び出し、Dataproc クラスタを作成する方法について説明します。
他の方法でクラスタを作成するには、次に挙げるページをご覧ください。
始める前に
- 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 Dataproc 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 Dataproc 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. リクエスト パラメータ:
- projectId を挿入します。
- 実際のクラスタが配置されている [region] を指定します(「us-central1」を必要に応じて置き換えます)。このクイックスタートでは、リージョン内のゾーンを指定していないため、Dataproc 自動ゾーン プレースメントによって、クラスタを作成するリージョン内のゾーンが選択されます。
リクエストの本文:
- [clusterName] を指定します(「example-cluster」を必要に応じて置き換えます)。ジョブの送信やクラスタの更新など、クラスタの操作にはこの名前を使用します。
[EXECUTE] をクリックします。API テンプレートを初めて実行する場合、Google アカウントを選択してログインし、Google API Explorer からアカウントへのアクセスを承認するように求められます。リクエストが成功すると、JSON のレスポンスで、クラスタの作成が保留中であることが示されます。
クラスタが作成されたことを確認するには、 Google Cloud コンソールで [Dataproc クラスタ] ページを開きます。クラスタのプロビジョニングが完了すると、クラスタの [ステータス] には「実行中」と表示されます。
- 他のクイックスタートの確認や、他のジョブを実行するためのクラスタが必要ない場合は、API Explorer、Google Cloud コンソール、gcloud CLI の gcloud コマンドライン ツール、または Cloud クライアント ライブラリを使用したクイックスタートを使用してクラスタを削除できます。
- テンプレートを使用して Spark ジョブを送信する方法を学習する。
クラスタを作成する
Dataproc ジョブを実行する前に、ジョブを実行する仮想マシンのクラスタを作成する必要があります。プロジェクトに Dataproc クラスタを作成するには、Google API Explorer の [Try this API] テンプレートに入力して実行します。
クリーンアップ
このページで使用したリソースについて、 Google Cloud アカウントに課金されないようにするには、次の手順を実施します。