使用機密運算建立執行個體

本文說明如何建立啟用機密運算功能的 Vertex AI Workbench 執行個體。

總覽

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

建立啟用機密運算的 Vertex AI Workbench 執行個體時,新的 Vertex AI Workbench 執行個體就是機密 VM 執行個體。如要進一步瞭解機密 VM 執行個體,請參閱機密 VM 簡介

事前準備

  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 Compute Engine and Notebooks APIs.

    Enable the APIs

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

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

  7. Enable the Compute Engine and Notebooks APIs.

    Enable the APIs

  8. 必要的角色

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

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

    建立執行個體

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

    gcloud

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

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

    • INSTANCE_NAME:Vertex AI 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

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

    REST

    如要建立啟用機密運算的 Vertex AI 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

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

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

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

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

      前往「Instances」(執行個體)

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

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

    3. 在「VM 詳細資料」旁,點選「在 Compute Engine 中查看」

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

    限制

    建立或使用啟用機密運算功能的 Vertex AI Workbench 執行個體時,會受到下列限制:

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

    • 建立 Vertex AI Workbench 執行個體後,您無法啟用或關閉機密運算。

    帳單

    雖然這項功能仍處於前測階段,但使用含有機密運算功能的 Vertex AI Workbench 執行個體,與使用不含機密運算功能的執行個體收費相同。請參閱定價

    後續步驟