本文档介绍了如何设置 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.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Google Cloud Dataproc API.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Google Cloud Dataproc API.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
您需要凭据吗?只有当您计划从应用或浏览器直接调用 Dataproc API 时,才需要使用凭据。如果您计划使用 Google Cloud 控制台或 Google Cloud CLI 创建和管理集群以及提交作业,则只需使用 gcloud init
命令登录 SDK。
可选:设置虚拟机
如果您计划从 Compute Engine 虚拟机 (VM) 实例运行 gcloud CLI,则必须设置虚拟机以访问 Google Cloud 服务。
如需测试您是否已正确设置虚拟机,请从命令行运行 gcloud compute instances describe YOUR_VM_INSTANCE_NAME
。包含 https://www.googleapis.com/auth/cloud-platform
范围的服务账号必须列在结果中。如需详细了解如何设置虚拟机,请参阅创建使用用户管理的服务账号的虚拟机。