建立機密運算執行個體

本文說明如何建立啟用機密運算的 Gemini Enterprise Agent Platform Workbench 執行個體。

總覽

機密運算可透過硬體式受信任的執行環境 (TEE) 保護使用中的資料。TEE 是安全且獨立的環境,可防止未經授權存取或修改應用程式和資料。這項安全標準是由機密運算聯盟定義。

建立 Agent Platform Workbench 執行個體時,如果啟用機密運算,新的 Agent Platform Workbench 執行個體就是機密 VM 執行個體。如要進一步瞭解機密 VM 執行個體,請參閱機密 VM 總覽

事前準備

  1. 登入 Google Cloud 帳戶。如果您是 Google Cloud新手,歡迎 建立帳戶,親自評估產品在實際工作環境中的成效。新客戶還能獲得價值 $300 美元的免費抵免額,可用於執行、測試及部署工作負載。
  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 Compute Engine and Notebooks APIs.

    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 APIs

  5. 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

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

  7. Enable the Compute Engine and Notebooks APIs.

    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 APIs

必要的角色

如要取得建立 Agent Platform Workbench 執行個體所需的權限,請要求管理員授予您專案的Notebooks Runner (roles/notebooks.runner) IAM 角色。如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。

您或許也能透過自訂角色或其他預先定義的角色,取得必要權限。

建立執行個體

您可以使用 Google Cloud 控制台、gcloud CLI 或 REST API,建立啟用機密運算的執行個體:

控制台

如要建立啟用機密運算的 Agent Platform Workbench 執行個體,請按照下列步驟操作:

  1. 前往 Google Cloud 控制台的「Instances」(執行個體) 頁面。

    前往「Instances」(執行個體)

  2. 按一下 「建立新標籤」

  3. 在「New instance」對話方塊中,按一下「Advanced options」

  4. 在「建立執行個體」對話方塊的「機型」部分,選取 N2D 機型。僅支援 N2D 機器類型。

  5. 在「Confidential VM service」(機密 VM 服務) 下方,選取「Enable Confidential Computing」(啟用機密運算)

  6. 在「Enable Confidential Computing」(啟用機密運算) 對話方塊中,按一下「Enable」(啟用)

  7. 點選「建立」

    Agent Platform Workbench 會建立執行個體並自動啟動。執行個體可供使用時,Agent Platform Workbench 會啟用「Open JupyterLab」(開啟 JupyterLab) 連結。

gcloud

如要建立啟用機密運算的 Agent Platform Workbench 執行個體,請使用 gcloud workbench instances create 指令,並將 --confidential-compute-type 設為 SEV

使用下列任何指令資料之前,請先替換以下項目:

  • INSTANCE_NAME:Agent Platform Workbench 執行個體的名稱;開頭須為英文字母,後面最多可接 62 個小寫英文字母、數字或連字號 (-),但結尾不得為連字號
  • PROJECT_ID:專案 ID
  • LOCATION:執行個體所在的可用區
  • MACHINE_TYPE:執行個體 VM 的機型,例如: n2d-standard-2

執行下列指令:

Linux、macOS 或 Cloud Shell

gcloud workbench instances create INSTANCE_NAME \
    --project=PROJECT_ID \
    --location=LOCATION \
    --machine-type=MACHINE_TYPE \
    --confidential-compute-type=SEV

Windows (PowerShell)

gcloud workbench instances create INSTANCE_NAME `
    --project=PROJECT_ID `
    --location=LOCATION `
    --machine-type=MACHINE_TYPE `
    --confidential-compute-type=SEV

Windows (cmd.exe)

gcloud workbench instances create INSTANCE_NAME ^
    --project=PROJECT_ID ^
    --location=LOCATION ^
    --machine-type=MACHINE_TYPE ^
    --confidential-compute-type=SEV

Agent Platform Workbench 會建立執行個體並自動啟動。執行個體可供使用時,Agent Platform Workbench 會在 Google Cloud 控制台中啟用「Open JupyterLab」連結。

REST

如要建立啟用機密運算的 Agent Platform Workbench 執行個體,請使用 projects.locations.instances.create 方法,並在 GceSetup 中加入 confidentialInstanceConfig

使用任何要求資料之前,請先修改下列項目的值:

  • PROJECT_ID:專案 ID
  • LOCATION:執行個體所在的可用區
  • MACHINE_TYPE:執行個體 VM 的機型,例如: n2d-standard-2

HTTP 方法和網址:

POST https://notebooks.googleapis.com/v2/projects/PROJECT_ID/locations/LOCATION/instances

JSON 要求內文:

{
  "gce_setup": {
    "machine_type": "MACHINE_TYPE",
    "confidentialInstanceConfig": {
      "confidentialInstanceType": SEV
    }
  }
}

如要傳送要求,請選擇以下其中一個選項:

curl

將要求主體儲存在名為 request.json 的檔案中,然後執行下列指令:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://notebooks.googleapis.com/v2/projects/PROJECT_ID/locations/LOCATION/instances"

PowerShell

將要求主體儲存在名為 request.json 的檔案中,然後執行下列指令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://notebooks.googleapis.com/v2/projects/PROJECT_ID/locations/LOCATION/instances" | Select-Object -Expand Content

Agent Platform Workbench 會建立執行個體並自動啟動。執行個體可供使用時,Agent Platform Workbench 會在 Google Cloud 控制台中啟用「Open JupyterLab」連結。

確認執行個體是否已啟用機密運算功能

如要確認 Agent Platform Workbench 執行個體是否已啟用機密運算功能,請按照下列步驟操作:

  1. 前往 Google Cloud 控制台的「Instances」(執行個體) 頁面。

    前往「Instances」(執行個體)

  2. 在「執行個體名稱」欄中,按一下要檢查的執行個體名稱。

    「執行個體詳細資料」頁面隨即開啟。

  3. 在「VM details」(VM 詳細資料) 旁,按一下「View in Compute Engine」(在 Compute Engine 中查看)

  4. 在 Compute Engine 詳細資料頁面中,「機密 VM 服務」的值會顯示 EnabledDisabled

限制

建立或使用啟用機密運算的 Agent Platform Workbench 執行個體時,須遵守下列限制:

  • 僅支援 N2D 機器類型。請參閱 N2D 機器類型

  • 系統僅支援 AMD SEV 機密運算技術。詳情請參閱「AMD SEV」。

  • 建立 Agent Platform Workbench 執行個體後,就無法啟用或停用機密運算功能。

帳單

使用 Agent Platform Workbench 執行個體搭配機密運算時,系統會根據下列項目向您收費:

後續步驟