管理執行階段範本的存取權
本頁說明如何在 Colab Enterprise 中授予及撤銷執行階段範本的存取權。
事前準備
- 登入 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 Vertex AI, Dataform, and Compute Engine APIs.
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.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Vertex AI, Dataform, and Compute Engine APIs.
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.
必要的角色
如要取得管理執行階段範本存取權所需的權限,請要求管理員授予您專案的 Colab Enterprise 管理員 (roles/aiplatform.colabEnterpriseAdmin) IAM 角色。如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。
授予執行階段範本的存取權
如要授予主體執行階段範本的存取權,可以使用 Google Cloud 控制台、Google Cloud CLI 或 Terraform。
控制台
-
前往 Google Cloud 控制台的 Colab Enterprise「執行階段範本」頁面。
-
在「Region」(地區) 選單中,選取包含執行階段範本的地區。
-
在「執行階段範本」選單中,選取執行階段範本。如果沒有列出任何執行階段範本,請建立執行階段範本。
-
按一下「權限」。
-
在「Permissions」(權限) 視窗中,按一下 「Add principal」(新增主體)。
-
在「授予存取權」對話方塊的「New principals」(新增主體) 欄位中,輸入一個或以半形逗號分隔的主體清單。
-
在「Select a role」(選取角色) 選單中,完成對話方塊以指派角色。
-
選用:按一下「新增其他角色」,然後重複上一個步驟。
-
按一下 [儲存]。
gcloud
使用下列任何指令資料之前,請先替換以下項目:
RUNTIME_TEMPLATE_ID:執行階段範本的 ID。PRINCIPAL:要新增繫結的主體。ROLE:要指派給主體的角色名稱。PROJECT_ID:您的專案 ID。REGION:執行階段範本所在的區域。
執行下列指令:
Linux、macOS 或 Cloud Shell
gcloud colab runtime-templates add-iam-policy-binding RUNTIME_TEMPLATE_ID \ --member=PRINCIPAL \ --role=ROLE \ --project=PROJECT_ID \ --region=REGION
Windows (PowerShell)
gcloud colab runtime-templates add-iam-policy-binding RUNTIME_TEMPLATE_ID ` --member=PRINCIPAL ` --role=ROLE ` --project=PROJECT_ID ` --region=REGION
Windows (cmd.exe)
gcloud colab runtime-templates add-iam-policy-binding RUNTIME_TEMPLATE_ID ^ --member=PRINCIPAL ^ --role=ROLE ^ --project=PROJECT_ID ^ --region=REGION
如要進一步瞭解如何從指令列管理執行階段範本的 IAM 政策,請參閱 gcloud CLI 說明文件。
Terraform
如要瞭解如何套用或移除 Terraform 設定,請參閱「基本 Terraform 指令」。詳情請參閱 Terraform 供應商參考文件。
下列範例使用
google_colab_runtime_template_iam_policy
Terraform 資源,授予 Colab Enterprise 執行階段範本的存取權。
data "google_iam_policy" "admin" { binding { role = "roles/viewer" members = [ "user:jane@example.com", ] } } resource "google_colab_runtime_template_iam_policy" "policy" { project = google_colab_runtime_template.runtime-template.project location = google_colab_runtime_template.runtime-template.location runtime_template = google_colab_runtime_template.runtime-template.name policy_data = data.google_iam_policy.admin.policy_data }
Colab Enterprise 主體包括使用者、群組或網域
您可以將存取權授予使用者、群組或網域。請參閱下表:
| 主體 | 使用者帳戶範例 |
|---|---|
| 單一使用者 | user@gmail.com |
| Google 群組 | admins@googlegroups.com |
| Google Workspace 網域 | example.com |
撤銷執行階段範本的存取權
如要撤銷執行階段範本的存取權,可以使用 Google Cloud 控制台或 gcloud CLI。
控制台
前往 Google Cloud 控制台的「IAM」(身分與存取權管理) 頁面。
選取專案、資料夾或機構。
找出包含要撤銷存取權主體的資料列。然後點選該列中的「Edit principal」(編輯主體) 圖示 。
針對要撤銷的角色按一下「刪除」圖示 按鈕,然後按一下「儲存」。
gcloud
使用下列任何指令資料之前,請先替換以下項目:
RUNTIME_TEMPLATE_ID:執行階段範本的 ID。PRINCIPAL:要撤銷存取權的主體。ROLE:要從主體移除的角色。PROJECT_ID:您的專案 ID。REGION:執行階段範本所在的區域。
執行下列指令:
Linux、macOS 或 Cloud Shell
gcloud colab runtime-templates remove-iam-policy-binding RUNTIME_TEMPLATE_ID \ --member=PRINCIPAL \ --role=ROLE \ --project=PROJECT_ID \ --region=REGION
Windows (PowerShell)
gcloud colab runtime-templates remove-iam-policy-binding RUNTIME_TEMPLATE_ID ` --member=PRINCIPAL ` --role=ROLE ` --project=PROJECT_ID ` --region=REGION
Windows (cmd.exe)
gcloud colab runtime-templates remove-iam-policy-binding RUNTIME_TEMPLATE_ID ^ --member=PRINCIPAL ^ --role=ROLE ^ --project=PROJECT_ID ^ --region=REGION
如要進一步瞭解如何從指令列管理執行階段範本的 IAM 政策,請參閱 gcloud CLI 說明文件。
後續步驟
- 如要瞭解如何授予筆記本存取權,請參閱「管理筆記本存取權」。