建立專案

如要在 App Engine 上部署應用程式,您必須建立 Google Cloud 專案,這是頂層容器,可存放 App Engine 應用程式資源和其他 Google Cloud 資源。

在這項工作中,您會建立 Google Cloud 專案和 App Engine 應用程式,以儲存應用程式的設定、運算資源、憑證和中繼資料。

如果您已有啟用 App Engine 和 Cloud Build API 的 Google Cloud 專案,請繼續撰寫網路服務

建立 Google Cloud 專案

  1. 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.
  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 billing is enabled for your Google Cloud project.

  4. Enable the Cloud Build 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

  5. Install the Google Cloud CLI.

  6. 若您採用的是外部識別資訊提供者 (IdP),請先使用聯合身分登入 gcloud CLI

  7. 執行下列指令,初始化 gcloud CLI:

    gcloud init
  8. 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

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

  10. Enable the Cloud Build 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

  11. Install the Google Cloud CLI.

  12. 若您採用的是外部識別資訊提供者 (IdP),請先使用聯合身分登入 gcloud CLI

  13. 執行下列指令,初始化 gcloud CLI:

    gcloud init
  14. 在 Google Cloud 控制台中為 Google Cloud 專案建立 App Engine 應用程式。

    開啟應用程式建立流程

  15. 選取應用程式運算資源的目標地區。

  16. 由於新專案中服務帳戶的預設使用方式有所異動,以及預設安全機構政策異動,您可能需要授予部署服務帳戶更多角色。如要進一步瞭解如何授予特定角色,請參閱疑難排解指南
  17. 後續步驟

    現在您已設定好 Google Cloud 專案,可以開始使用 Java 編寫基本網路服務