使用 Google Cloud 控制台建立工作流程
本快速入門導覽課程說明如何使用 Google Cloud 控制台,建立、部署及執行您的第一項工作流程。範例工作流程會向公用 API 傳送要求,然後傳回 API 的回應。
如要直接在 Google Cloud 控制台中,按照這項工作的逐步指南操作,請按一下「Guide me」(逐步引導):
事前準備
貴機構定義的安全性限制,可能會導致您無法完成下列步驟。如需疑難排解資訊,請參閱「在受限的 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.
-
If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Workflows 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.-
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.
-
If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Workflows 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.- 設定驗證方法:
-
<
-
確認您具備「建立服務帳戶」身分與存取權管理角色 (
roles/iam.serviceAccountCreator) 和「專案 IAM 管理員」角色 (roles/resourcemanager.projectIamAdmin)。瞭解如何授予角色。 -
前往 Google Cloud 控制台的「Create service account」(建立服務帳戶) 頁面。
前往「建立服務帳戶」 - 選取專案。
-
在「Service account name」(服務帳戶名稱) 欄位中輸入名稱。 Google Cloud 控制台會將這個名稱填入「Service account ID」(服務帳戶 ID) 欄位。
在「Service account description」(服務帳戶說明) 欄位中輸入說明。例如:
Service account for quickstart。 - 按一下「建立並繼續」。
-
將「記錄」>「記錄檔寫入者」角色授予服務帳戶。
如要授予角色,請找出 選取角色 清單,然後依序選取 記錄 > 記錄寫入者。
- 按一下 [繼續]。
-
按一下「Done」(完成),即完成建立服務帳戶。
-
確認您具備「建立服務帳戶」身分與存取權管理角色 (
如要進一步瞭解服務帳戶角色和權限,請參閱授予工作流程存取 Google Cloud 資源的權限。
必要的角色
如要取得完成本快速入門導覽課程所需的權限,請要求管理員在專案中授予您下列 IAM 角色:
-
服務帳戶使用者 (
roles/iam.serviceAccountUser) -
Workflows 管理員 (
roles/workflows.admin)
如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。
建立及部署工作流程
前往 Google Cloud 控制台的「Workflows」頁面:
在「Workflows」頁面中,按一下 「Create」(建立)。
輸入新工作流程的名稱,例如
myFirstWorkflow。選擇「us-central1」做為區域。
在「服務帳戶」部分,選取您先前建立的服務帳戶。
選取「下一步」。
-
YAML
JSON
除非您自行輸入搜尋字詞,否則工作流程會使用您的Google Cloud 位置建構搜尋字詞,並將搜尋字詞傳送至 Wikipedia API。系統會傳回相關的維基百科文章清單。
選取 [Deploy] (部署)。
執行工作流程
成功部署工作流程後,即可首次執行。部署工作流程之後,系統會將您帶往「Workflow details」(工作流程詳細資料) 頁面。
在「工作流程詳細資料」頁面中,按一下 「執行」。
在「Execute workflow」(執行工作流程) 頁面中,按一下「Execute」(執行)。
「Output」(輸出) 窗格會顯示工作流程結果。
您已部署並執行第一項工作流程!
清除所用資源
為了避免系統向您的 Google Cloud 帳戶收取本頁面所用資源的費用,請按照下列步驟操作。
前往 Google Cloud 控制台的「Workflows」頁面:
在工作流程清單中,按一下工作流程即可前往「Workflow details」(工作流程詳細資料) 頁面。
按一下 「Delete」(刪除)。
輸入工作流程名稱,然後按一下「確認」。