您必須建立 Google Cloud 專案與 App Engine 應用程式資源,才能將應用程式部署至 App Engine。
Google Cloud 專案是頂層容器,存放您的 App Engine 應用程式及其他 Google Cloud 資源。
App Engine 應用程式是一種資源,您必須建立該資源才能啟用 App Engine。App Engine 應用程式資源可定義您想要執行網路服務並儲存其相關設定、憑證與中繼資料的所在地區。您只能為每個 Google Cloud 專案建立一個 App Engine 應用程式資源,且建立這些資源之後,就無法再變更指定地區。
如果您已經有啟用 App Engine 和 Cloud Build API 的專案,可以繼續撰寫您的網路服務。 Google Cloud
建立 Google Cloud 專案
- 登入 Google Cloud 帳戶。如果您是 Google Cloud新手,歡迎 建立帳戶,親自評估產品在實際工作環境中的成效。新客戶還能獲得價值 $300 美元的免費抵免額,可用於執行、測試及部署工作負載。
-
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 theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
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 theserviceusage.services.enablepermission. Learn how to grant roles.-
安裝 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.
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 theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
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 theserviceusage.services.enablepermission. Learn how to grant roles.-
安裝 Google Cloud CLI。
-
若您採用的是外部識別資訊提供者 (IdP),請先使用聯合身分登入 gcloud CLI。
-
執行下列指令,初始化 gcloud CLI:
gcloud init -
執行下列
gcloud指令以啟用 App Engine 並建立關聯應用程式資源。請注意,您選取的位置一經設定即無法變更。gcloud app create
- 由於新專案中服務帳戶的預設使用方式有所異動,且機構政策預設會啟用安全防護機制,您可能需要授予部署服務帳戶更多角色。如要進一步瞭解如何授予特定角色,請參閱疑難排解指南。
App Engine 位置
App Engine 具有「地區性」,這表示執行應用程式的基礎架構位於特定地區,且由 Google 代管,可為該地區內的所有區域提供備援功能。
選擇應用程式的執行地區時,請將您在延遲時間、可用性和耐用性方面的要求,做為主要考量。一般來說,您可以選擇距離應用程式使用者最近的區域,但您也應該考量 App Engine 的適用位置,以及應用程式使用的其他Google Cloud 產品和服務的位置。如果跨多個位置使用服務,可能會影響應用程式的延遲時間和定價。
應用程式的地區設定完成後即無法更改。
如果您已建立 App Engine 應用程式,可以透過下列方式查看其區域:
後續步驟
現在您已設定好 Google Cloud 專案,可以開始撰寫基本網路服務。