本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
資料表最佳化先決條件
資料表最佳化工具會假設您在啟用資料表的最佳化選項時所指定的 AWS Identity and Access Management (IAM) 角色權限。您可以為所有最佳化工具建立單一角色,也可以為每個最佳化工具建立個別的角色。IAM角色必須具有讀取資料和更新資料目錄中繼資料的權限。您可以建立IAM角色並附加下列內嵌原則:
-
新增下列內嵌政策,針對未向 Lake Formation 註冊的資料的位置授予 Amazon S3 讀取/寫入權限。此原則也包含更新資料目錄中的表格,以及允許在記錄檔中 Amazon CloudWatch 新 AWS Glue 增記錄檔和發佈指標的權限。對於未向 Lake Formation 註冊的 Amazon S3 中的來源資料,存取由 Amazon S3 的IAM許可政策和 AWS Glue 動作決定。
在下列內嵌政策中,請將
bucket-name
取代為 Amazon S3 儲存貯體名稱,將aws-account-id
和region
取代為有效的 AWS 帳號和 Data Catalog 的區域,將database_name
取代為資料庫的名稱,以及將table_name
取代為資料表的名稱。{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject" ], "Resource": [ "arn:aws:s3:::
<bucket-name>
/*" ] }, { "Effect": "Allow", "Action": [ "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::<bucket-name>
" ] }, { "Effect": "Allow", "Action": [ "glue:UpdateTable", "glue:GetTable" ], "Resource": [ "arn:aws:glue:<region>
:<aws-account-id>
:table/<database-name>
/<table-name>
", "arn:aws:glue:<region>
:<aws-account-id>
:database/<database-name>
", "arn:aws:glue:<region>
:<aws-account-id>
:catalog" ] }, { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": [ "arn:aws:logs:<region>
:<aws-account-id>
:log-group:/aws-glue/iceberg-compaction/logs:*" } ] } -
使用下列政策針對向 Lake Formation 註冊的資料啟用壓縮功能。
如果最佳化角色沒有授與資料表的
IAM_ALLOWED_PRINCIPALS
群組權限,則該角色需要 Lake FormationALTER
INSERT
和資料表的DELETE
權限。DESCRIBE
如需透過 Lake Formation 註冊 Amazon S3 儲存貯體的詳細資訊,請參閱將 Amazon S3 位置新增至資料湖。
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "lakeformation:GetDataAccess" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "glue:UpdateTable", "glue:GetTable" ], "Resource": [ "arn:aws:glue:
<region>
:<aws-account-id>
:table/<databaseName>
/<tableName>
", "arn:aws:glue:<region>
:<aws-account-id>
:database/<database-name>
", "arn:aws:glue:<region>
:<aws-account-id>
:catalog" ] }, { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": [ "arn:aws:logs:<region>
:<aws-account-id>
:log-group:/aws-glue/iceberg-compaction/logs:*" } ] } -
(選擇性) 若要使用伺服器端加密加密的 Amazon S3 儲存貯體中的資料來最佳化 Iceberg 表格,壓縮角色需要解密 Amazon S3 物件並產生新的資料金鑰以將物件寫入加密儲存貯體的許可。將下列原則新增至所需的 AWS KMS 金鑰。我們僅支援儲存貯體層級加密。
{ "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::
<aws-account-id>
:role/<optimizer-role-name>
" }, "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": "*" } -
(選用) 針對向 Lake Formation 註冊的資料位置,用於註冊該位置的角色需要解密 Amazon S3 物件並產生新的資料金鑰以將物件寫入加密儲存貯體的權限。如需詳細資訊,請參閱註冊加密的 Amazon S3 位置。
-
(選擇性) 如果 AWS KMS 金鑰儲存在不同的 AWS 帳戶中,您必須包含壓縮角色的下列權限。
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": ["arn:aws:kms:
<REGION>
:<KEY_OWNER_ACCOUNT_ID>
:key/<KEY_ID>
" ] } ] } -
您用來執行壓縮程序的角色必須具有該角色的
iam:PassRole
權限。{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::
<account-id>
:role/<optimizer-role-name>
" ] } ] } -
將下列信任原則新增至 AWS Glue 服務角色,以IAM扮演執行壓縮程序的角色。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "", "Effect": "Allow", "Principal": { "Service": "glue.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }