为现有的 Apache Iceberg REST 目录启用凭据自动售卖模式,可将 Lakehouse for Apache Iceberg 配置为向授权的查询引擎或工作负载自动售卖短期、降级范围的存储令牌。
在 Lakehouse 运行时目录中,此身份验证方法可让您或查询运行时无需对底层 Cloud Storage 存储桶拥有直接读取和写入权限。
准备工作
- 请参阅关于 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 Admin (
roles/biglake.admin) 角色 - 您项目的 Storage Admin (
roles/storage.admin)
- 针对项目的 BigLake Admin (
-
自动配置的 Apache Iceberg REST Catalog 服务账号:所有关联的 Cloud Storage 存储分区上的存储对象用户 (
roles/storage.objectUser)。启用凭据自动售卖后,请向目录的自动配置 Apache Iceberg REST Catalog 服务账号明确授予所有关联存储分区的 Storage Object User 角色 (roles/storage.objectUser)。
如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限。
启用凭证自动售卖
如果 Apache Iceberg REST 目录的身份验证方法设置为最终用户凭据,您可以将其切换为凭证分发模式。
控制台
- 在 Google Cloud 控制台中,打开 Lakehouse 页面。
在您要更新的目录所在的行中,依次选择 更多目录操作 > 修改身份验证。
在身份验证对话框中,选择凭据贩售模式。 自动配置的 Apache Iceberg REST Catalog 服务账号需要对所有关联的 Cloud Storage 存储分区具有明确的 Storage Object User 角色 (
roles/storage.objectUser)。默认情况下,它没有访问权限。如果没有此角色,出售的凭据就没有足够的范围来执行存储写入操作。选择保存。
Your catalog is updated and the **Catalog details** page opens.在身份验证方法下,选择设置存储桶权限。
在对话框中,选择确认。
这会验证您目录的服务账号是否在所有关联的存储分区中都具有 Storage Object User 角色 (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 存储桶目录,此值与 REST 目录使用的 Cloud Storage 存储桶 ID 相匹配。从 BigQuery 查询这些表时,此名称也用作目录标识符。PROJECT_ID: Google Cloud项目 ID。启用凭据自动售卖后,请在所有关联的存储分区上向目录的自动配置 Apache Iceberg REST Catalog 服务账号明确授予 Storage Object User 角色 (
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。