本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
-
建立資料湖管理員 - 建立已獲授權接受命名空間邀請的 IAM 角色,並建立 AWS Glue Data Catalog 物件 (目錄、資料庫、資料表/檢視),並將 Lake Formation 許可授予其他使用者。
如需建立資料湖管理員的step-by-step說明,請參閱建立資料湖管理員。
-
更新資料湖管理員許可。
除了資料湖管理員許可之外,資料湖管理員還需要下列許可,才能在 Lake Formation 中接受 Amazon Redshift 命名空間邀請、建立或更新 Data Catalog 資源,以及啟用資料湖存取:
{ "Version": "2012-10-17", "Id": "glue-enable-datalake-access", "Statement": [ { "Effect": "Allow", "Action": [ "redshift:AssociateDataShareConsumer", "redshift:DescribeDataSharesForConsumer", "redshift:DescribeDataShares", "redshift-serverless:CreateNamespace", "redshift-serverless:CreateWorkgroup", "redshift-serverless:DeleteNamespace", "redshift-serverless:DeleteWorkgroup", "ec2:DescribeAccountAttributes", "ec2:DescribeSubnets", "ec2:DescribeSecurityGroups", "ec2:DescribeAvailabilityZones", "s3:createBucket", "s3:deleteBucket", "s3:putBucketPolicy", "s3:putEncryptionConfiguration", "s3:putLifecycleConfiguration", "s3:putBucketVersioning", "iam:CreateRole" ], "Resource": "*" } ] } { "Action": [ "iam:PassRole" ], "Effect": "Allow", "Resource": "arn:aws:iam::*:role/
data transfer role name
", "Condition": { "StringLike": { "iam:PassedToService": [ "glue.amazonaws.com" ] } } } -
如果用於建立聯合目錄的 IAM 角色不是資料湖管理員,您需要授予該角色
Create catalog
許可。建立目錄建立者
開啟 Lake Formation 主控台,網址為 https://console.aws.amazon.com/lakeformation/
。 在管理下選擇管理角色和任務。
選擇 Grant (授予)。
在授予許可畫面上,選擇 IAM 使用者或角色。
選取建立目錄許可。
您也可以選擇授予可授予的建立目錄許可。可授予的許可允許目錄建立者將
Create catalog
許可授予其他主體。選擇 Grant (授予)。
AWS CLI 授予建立聯合目錄許可的範例。
aws lakeformation grant-permissions \ --cli-input-json \ '{ "Principal": { "DataLakePrincipalIdentifier":"arn:aws:iam::123456789012:role/Admin" }, "Resource": { "Catalog": { } }, "Permissions": [ "CREATE_CATALOG", "DESCRIBE" ] }'
-
建立唯讀管理員角色,以在 Amazon Redshift 查詢編輯器 v2 的資料目錄中探索 Amazon Redshift 聯合目錄。
若要從 Amazon Redshift 查詢編輯器 v2 查詢聯合目錄中的 Amazon Redshift 資料表,請確定唯讀管理員角色政策包含 Amazon Redshift 服務連結角色的 ARN
AWSServiceRoleForRedshift
。aws lakeformation put-data-lake-settings --region us-east-1 \ --data-lake-settings \ '{ "DataLakeAdmins": [{"DataLakePrincipalIdentifier":"arn:aws:iam::123456789012:role/Admin"}], "ReadOnlyAdmins":[{"DataLakePrincipalIdentifier":"arn:aws:iam::123456789012:role/aws-service-role/redshift.amazonaws.com/AWSServiceRoleForRedshift"}], "CreateDatabaseDefaultPermissions":[], "CreateTableDefaultPermissions":[], "Parameters":{"CROSS_ACCOUNT_VERSION":"4","SET_CONTEXT":"TRUE"} }'
-
建立 Amazon Redshift 可代表您擔任的資料傳輸角色,以往返 Amazon S3 儲存貯體傳輸資料。
當您啟用 Apache Iceberg 相容查詢引擎的資料湖存取,例如 Athena、Amazon EC2 上的 Amazon EMR,以存取 Data Catalog 中的 Amazon Redshift 資源時,您需要建立具有必要許可的 IAM 角色,以執行往返 Amazon S3 儲存貯體的資料傳輸。
{ "Version": "2012-10-17", "Id": "glue-enable-datalake-access", "Statement": [{ "Sid": "DataTransferRole policy", "Effect": "Allow", "Action": [ "glue:GetCatalog", "glue:GetDatabase", "kms:GenerateDataKey", "kms:Decrypt"], "Resource": "*" } ] }
-
將下列信任政策新增至 AWS Glue 和 Amazon Redshift 服務的資料傳輸角色,以擔任角色來往返 Amazon S3 儲存貯體傳輸資料。
{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "Service": [ "redshift.amazonaws.com", "glue.amazonaws.com" ] }, "Action": "sts:AssumeRole" }] }
-
如果您使用客戶受管金鑰來加密 Amazon Redshift 叢集/命名空間中的資料,請將下列金鑰政策新增至 AWS KMS 金鑰。將帳戶號碼取代為有效的 AWS 帳戶號碼,並指定資料傳輸角色名稱。根據預設,Amazon Redshift 叢集中的資料會使用 KMS 金鑰加密。Lake Formation 提供建立自訂 KMS 金鑰以進行加密的選項。如果您使用的是客戶受管金鑰,則必須將特定金鑰政策新增至金鑰。
如需管理客戶受管金鑰許可的詳細資訊,請參閱客戶受管金鑰。
{ "Version": "2012-10-17", "Id": "auto-redshift-3", "Statement": [ { "Sid": "Allow access through RedShift for all principals in the account that are authorized to use RedShift", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": [ "kms:Encrypt", "kms:Decrypt", "kms:ReEncrypt*", "kms:GenerateDataKey*", "kms:CreateGrant", "kms:DescribeKey" ], "Resource": "*", "Condition": { "StringEquals": { "kms:CallerAccount": "
123456789012
", "kms:ViaService": "redshift.us-east-1.amazonaws.com" } } }, { "Sid": "Allow access through RedShift-Serverless for all principals in the account that are authorized to use RedShift-Serverless", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": [ "kms:Encrypt", "kms:Decrypt", "kms:ReEncrypt*", "kms:GenerateDataKey*", "kms:CreateGrant", "kms:DescribeKey" ], "Resource": "*", "Condition": { "StringEquals": { "kms:CallerAccount": "123456789012
", "kms:ViaService": "redshift-serverless.us-east-1.amazonaws.com" } } }, { "Sid": "Allow direct access to key metadata to the account", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::123456789012
:root" }, "Action": [ "kms:Describe*", "kms:Get*", "kms:List*", "kms:RevokeGrant" ], "Resource": "*" }, { "Sid": "Allow GenerateDataKey + Decrypt to the DataTransferRole via s3", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::123456789012
:role/data-transfer-role-name
" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "*" }, "Condition": { "StringEquals": { "kms:ViaService": "s3.us-east-1.amazonaws.com
" } } ] }