本文說明如何設定 Google Cloud 專案和 Compute Engine 虛擬機器 (VM)。
設定 Google Cloud 專案
- 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.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Google Cloud Dataproc API.
-
Install the Google Cloud CLI.
-
如果您使用外部識別資訊提供者 (IdP),請先 使用聯合身分登入 gcloud CLI。
-
如要初始化 gcloud CLI,請執行下列指令:
gcloud init
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Google Cloud Dataproc API.
-
Install the Google Cloud CLI.
-
如果您使用外部識別資訊提供者 (IdP),請先 使用聯合身分登入 gcloud CLI。
-
如要初始化 gcloud CLI,請執行下列指令:
gcloud init
您是否需要憑證?只有當您打算直接從應用程式或瀏覽器呼叫 Dataproc API 時,才需要憑證。如果您打算使用 Google Cloud 主控台或 Google Cloud CLI 建立及管理叢集,並提交工作,只需要使用 gcloud init
指令登入 SDK 即可。
選用:設定 VM
如果您打算從 Compute Engine 虛擬機器 (VM) 執行個體執行 gcloud CLI,則必須設定 VM,以存取 Google Cloud 服務。
如要測試 VM 是否設定正確,請從指令列執行 gcloud compute instances describe YOUR_VM_INSTANCE_NAME
。畫面上必須列出包含 https://www.googleapis.com/auth/cloud-platform
範圍的服務帳戶。如要進一步瞭解如何設定 VM,請參閱「建立使用使用者管理服務帳戶的 VM」。