建立專案

如要在 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.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Enable the Cloud Build API.

    Enable the API

  5. Install the Google Cloud CLI.

  6. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  7. To initialize the gcloud CLI, run the following command:

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

    Go to project selector

  9. Make sure that billing is enabled for your Google Cloud project.

  10. Enable the Cloud Build API.

    Enable the API

  11. Install the Google Cloud CLI.

  12. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  13. To initialize the gcloud CLI, run the following command:

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

    開啟應用程式建立流程

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

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

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