為現有 Apache Iceberg REST 目錄啟用憑證販售模式,可將 Lakehouse for Apache Iceberg 設為向授權的查詢引擎或工作負載販售存取權範圍縮減的短期儲存空間權杖。
在 Lakehouse 執行階段目錄中,這個驗證方法可讓您或查詢執行階段不必持有基礎 Cloud Storage bucket 的直接讀取和寫入權限。
事前準備
- 請參閱「關於 Lakehouse 執行階段目錄」,瞭解 Lakehouse 執行階段目錄的運作方式和服務限制。
- 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. - 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.
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
Verify that billing is enabled for your Google Cloud project.
Enable the BigLake API.
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.
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
Verify that billing is enabled for your Google Cloud project.
Enable the BigLake API.
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.
必要的角色
如要取得啟用憑證販售功能所需的權限,請要求管理員授予您下列 IAM 角色:
-
全部:
- 專案的 BigLake 管理員 (
roles/biglake.admin) - 專案的儲存空間管理員 (
roles/storage.admin)
- 專案的 BigLake 管理員 (
-
自動佈建的 Apache Iceberg REST 目錄服務帳戶:
所有相關聯的 Cloud Storage bucket 上的「Storage 物件使用者」 (
roles/storage.objectUser)。啟用憑證販售功能後,請在所有相關聯的儲存空間 bucket 中,明確授予目錄的自動佈建 Apache Iceberg REST 目錄服務帳戶「Storage 物件使用者」角色 (roles/storage.objectUser)。
如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。
啟用憑證販售功能
如果 Apache Iceberg REST 目錄的驗證方法設為使用者憑證,您可以切換為憑證臨時配發模式。
控制台
- 在 Google Cloud 控制台中開啟「Lakehouse」Lakehouse頁面。
在要更新的目錄列中,選取 「更多目錄動作」>「編輯驗證」。
在驗證對話方塊中,選取「憑證臨時配發模式」。 自動佈建的 Apache Iceberg REST 目錄服務帳戶,需要所有相關聯 Cloud Storage bucket 的明確 Storage 物件使用者角色 (
roles/storage.objectUser)。根據預設,該帳戶沒有存取權。如果沒有這個角色,販售的憑證範圍不足,無法執行儲存空間寫入作業。選取「儲存」。
Your catalog is updated and the **Catalog details** page opens.在「驗證方式」下方,選取「設定值區權限」。
在對話方塊中選取「確認」。
這會驗證目錄的服務帳戶是否在所有相關聯的儲存空間 bucket 中,都具備「Storage 物件使用者」角色 (roles/storage.objectUser)。
gcloud
使用 gcloud biglake iceberg catalogs update 指令。
gcloud biglake iceberg catalogs update \ CATALOG_NAME \ --project PROJECT_ID \ --credential-mode vended-credentials
更改下列內容:
CATALOG_NAME:目錄名稱。如果是 Lakehouse 目錄,這是您的自訂目錄名稱。如果是 Cloud Storage bucket 目錄,這會與 REST 目錄使用的 Cloud Storage bucket ID 相符。從 BigQuery 查詢這些資料表時,這個名稱也會做為目錄 ID。PROJECT_ID:您的 Google Cloud專案 ID。啟用憑證販售功能後,請在所有相關聯的儲存空間值區上,明確授予目錄的自動佈建 Apache Iceberg REST 目錄服務帳戶 Storage 物件使用者角色 (
roles/storage.objectUser)。
REST
如要使用 REST API 啟用憑證販售模式,請對 UpdateIcebergCatalog 端點發出 PATCH 要求:
PATCH /iceberg/v1/restcatalog/extensions/projects/PROJECT_ID/catalogs/CATALOG_ID?updateMask=icebergCatalog.credential_mode
要求主體必須包含 IcebergCatalog JSON 酬載,且 credential_mode 設為 VENDED_CREDENTIALS。
更改下列內容:
PROJECT_ID:您的 Google Cloud 專案 ID。CATALOG_ID:Lakehouse 執行階段目錄的 ID。