创建项目

要在 App Engine 上部署应用,您必须创建 Google Cloud 项目,该项目是一个保留 App Engine 应用资源及其他 Google Cloud 资源的顶级容器。

在本任务中,您将创建一个 Google Cloud 项目和一个 App Engine 应用来存储应用的设置、计算资源、凭据和元数据。

如果您已有启用了 App Engine 和 Cloud Build API 的 Google Cloud 项目,则继续编写 Web 服务

创建 Google Cloud 项目

  1. 登录您的 Google Cloud 账号。如果您是 Google Cloud 新手,请创建一个账号来评估我们的产品在实际场景中的表现。新客户还可获享 $300 赠金,用于运行、测试和部署工作负载。
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. 确保您的 Google Cloud 项目已启用结算功能

  4. 启用 Cloud Build API。

    启用 API

  5. Install the Google Cloud CLI.
  6. To initialize the gcloud CLI, run the following command:

    gcloud init
  7. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  8. 确保您的 Google Cloud 项目已启用结算功能

  9. 启用 Cloud Build API。

    启用 API

  10. Install the Google Cloud CLI.
  11. To initialize the gcloud CLI, run the following command:

    gcloud init
  12. 在 Google Cloud 控制台中为您的 Google Cloud 项目创建 App Engine 应用。

    打开应用创建

  13. 选择您希望应用的计算资源所位于的区域。

后续步骤

现在您的 Google Cloud 项目已设置完毕,您可以开始使用 Java 编写基本的 Web 服务了。