Lake Formation 角色和 IAM 許可參考 - AWS Lake Formation

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

Lake Formation 角色和 IAM 許可參考

本節列出了一些建議的 Lake Formation 角色及其建議的 AWS Identity and Access Management (IAM)許可。如需 Lake Formation 權限的相關資訊,請參閱Lake Formation 權限參考

AWS Lake Formation 人物

下表列出建議的 AWS Lake Formation 人物角色。

Lake Formation 角色
人物 描述
IAM 管理員 (超級使用者) (必要) 可建立 IAM 使用者和角色的使用者。具有受AdministratorAccess AWS 管策略。擁有所有 Lake Formation 資源的所有權限。可以新增資料湖管理員。如果未指定資料湖管理員,則無法授與 Lake Formation 權限。
資料湖管理員 (必要) 可註冊 Amazon S3 位置、存取資料目錄、建立資料庫、建立和執行工作流程、授與 Lake Formation 權限給其他使用者,以及檢視 AWS CloudTrail 日誌的使用者。IAM 許可比 IAM 管理員少,但足以管理資料湖。無法新增其他資料湖管理員。
唯讀管理員 (選擇性) 可檢視主參與者、資料目錄資源、權限和 AWS CloudTrail 記錄檔的使用者,而無需進行更新的權限。
數據工程師 (選擇性) 可建立資料庫、建立和執行編目器和工作流程,以及授與檢索器和工作流程所建立之「資料目錄」表格 Lake Formation 權限的使用者。我們建議您讓所有的資料工程師資料庫建立者。如需詳細資訊,請參閱 建立資料庫
資料分析 (選擇性) 可以使用,例如,對資料湖執行查詢的使用者 Amazon Athena。只有足夠的權限來執行查詢。
工作流角色 (必要) 代表使用者執行工作流程的角色。您可以在從藍圖建立工作流程時指定此角色。

AWS 對 Lake Formation 的管理政策

您可以使用 AWS 受管政策和內嵌政策,授予使用 AWS Lake Formation 所需的 AWS Identity and Access Management (IAM) 許可。以下 AWS 管理政策適用於 Lake Formation。

AWS 受管理的策略:AWSLakeFormationDataAdmin

AWSLakeFormationDataAdmin原則會授予管理存取權限以 AWS Lake Formation 及相關服務 (例 AWS Glue 如管理資料湖)。

您可以附加AWSLakeFormationDataAdmin至您的使用者、群組和角色。

許可權詳細

  • CloudTrail— 允許主參與者檢視記 AWS CloudTrail 錄檔。若要檢閱資料湖設定中的任何錯誤,則必須執行此動作。

  • Glue— 可讓主參與者檢視、建立及更新「資料目錄」中的中繼資料表格和資料庫。這包括以Get、、、ListCreateUpdate和開頭的 API 作業SearchDelete這是管理資料湖表格的中繼資料所必需的。

  • IAM— 允許主體擷取附加至角色的 IAM 使用者、角色和政策的相關資訊。資料管理員必須檢閱和列出 IAM 使用者和角色,才能授予 Lake Formation 權限。

  • Lake Formation— 授予資料湖管理員需要 Lake Formation 權限才能管理資料湖。

  • S3— 允許主體擷取 Amazon S3 儲存貯體及其位置的相關資訊,以便設定資料湖的資料位置。

"Statement": [ { "Sid": "AWSLakeFormationDataAdminAllow", "Effect": "Allow", "Action": [ "lakeformation:*", "cloudtrail:DescribeTrails", "cloudtrail:LookupEvents", "glue:GetDatabase", "glue:GetDatabases", "glue:CreateDatabase", "glue:UpdateDatabase", "glue:DeleteDatabase", "glue:GetConnections", "glue:SearchTables", "glue:GetTable", "glue:CreateTable", "glue:UpdateTable", "glue:DeleteTable", "glue:GetTableVersions", "glue:GetPartitions", "glue:GetTables", "glue:ListWorkflows", "glue:BatchGetWorkflows", "glue:DeleteWorkflow", "glue:GetWorkflowRuns", "glue:StartWorkflowRun", "glue:GetWorkflow", "s3:ListBucket", "s3:GetBucketLocation", "s3:ListAllMyBuckets", "s3:GetBucketAcl", "iam:ListUsers", "iam:ListRoles", "iam:GetRole", "iam:GetRolePolicy" ], "Resource": "*" }, { "Sid": "AWSLakeFormationDataAdminDeny", "Effect": "Deny", "Action": [ "lakeformation:PutDataLakeSettings" ], "Resource": "*" } ] }
注意

此原AWSLakeFormationDataAdmin則不會授與資料湖管理員所需的所有權限。需要其他權限才能建立和執行工作流程,以及使用服務連結角色註冊位置AWSServiceRoleForLakeFormationDataAccess。如需詳細資訊,請參閱 建立資料湖管理員使用服務連結角色進行 Lake Formation

AWS 受管理的策略:AWSLakeFormationCrossAccountManager

AWSLakeFormationCrossAccountManager政策通過 Lake Formation 提供跨帳戶訪問 AWS Glue 資源的權限,並授予對其他必要服務的讀取訪問權限,例如 AWS Organizations 和 AWS RAM。

您可以附加AWSLakeFormationCrossAccountManager至您的使用者、群組和角色。

許可權詳細

此政策包含以下許可。

  • Glue— 允許主參與者設定或刪除資料目錄資源原則以進行存取控制。

  • Organizations— 允許主參與者擷取組織的帳戶與組織單位 (OU) 資訊。

  • ram:CreateResourceShare— 允許主參與者建立資源共用。

  • ram:UpdateResourceShare允許主參與者修改指定資源共用的某些內容。

  • ram:DeleteResourceShare— 允許主參與者刪除指定的資源共用。

  • ram:AssociateResourceShare— 允許主參與者將指定的主參與者清單和資源清單新增至資源共用。

  • ram:DisassociateResourceShare— 允許主參與者從參與指定的資源共用中移除指定的主參與者或資源。

  • ram:GetResourceShares— 允許主參與者擷取有關您擁有或與您共用之資源共用的詳細資訊。

  • ram:RequestedResourceType— 允許主參與者擷取資源類型 (資料庫、表格或目錄)。

  • AssociateResourceSharePermission— 允許主參與者新增或取代資源共用中包含之資源類型的 AWS RAM 權限。您可以只有一個與資源共用中的每個資源類型相關聯的權限。

{ "Version": "2012-10-17", "Statement": [{ "Sid": "AllowCreateResourceShare", "Effect": "Allow", "Action": [ "ram:CreateResourceShare" ], "Resource": "*", "Condition": { "StringLikeIfExists": { "ram:RequestedResourceType": [ "glue:Table", "glue:Database", "glue:Catalog" ] } } }, { "Sid": "AllowManageResourceShare", "Effect": "Allow", "Action": [ "ram:UpdateResourceShare", "ram:DeleteResourceShare", "ram:AssociateResourceShare", "ram:DisassociateResourceShare", "ram:GetResourceShares" ], "Resource": "*", "Condition": { "StringLike": { "ram:ResourceShareName": [ "LakeFormation*" ] } } }, { "Sid": "AllowManageResourceSharePermissions", "Effect": "Allow", "Action": [ "ram:AssociateResourceSharePermission" ], "Resource": "*", "Condition": { "StringLike": { "ram:PermissionArn": [ "arn:aws:ram::aws:permission/AWSRAMLFEnabled*" ] } } }, { "Sid": "AllowXAcctManagerPermissions", "Effect": "Allow", "Action": [ "glue:PutResourcePolicy", "glue:DeleteResourcePolicy", "organizations:DescribeOrganization", "organizations:DescribeAccount", "ram:Get*", "ram:List*" ], "Resource": "*" }, { "Sid": "AllowOrganizationsPermissions", "Effect": "Allow", "Action": [ "organizations:ListRoots", "organizations:ListAccountsForParent", "organizations:ListOrganizationalUnitsForParent" ], "Resource": "*" } ] }

AWS 受管理的策略:AWSGlueConsoleFullAccess

AWSGlueConsoleFullAccess當附加原則的身分識別使用時,策略會授與 AWS Glue 資源的完整存取權 AWS Management Console。如果您依照此政策中指定的資源命名慣例,使用者就能擁有完整的主控台功能。此原則通常會附加至 AWS Glue 主控台的使用者。

此外AWS Glue,Lake Formation 擔任服務角色,AWSGlueServiceRole允許存取相關服務,包括 Amazon 彈性運算雲 (Amazon EC2)、亞馬遜簡單儲存服務 (Amazon S3) 和亞馬遜 CloudWatch。

AWS managed policy:LakeFormationDataAccessServiceRolePolicy

此原則會附加至名為的服務連結角色,ServiceRoleForLakeFormationDataAccess該角色可讓服務根據您的要求對資源執行動作。您無法將此政策附加到 IAM 身分。

此政策允許 Lake Formation 整合 AWS 服務 (例如 Amazon Athena 或 Amazon Redshift) 使用服務連結角色來探索 Amazon S3 資源。

若要取得更多資訊,請參閱使用服務連結角色進行 Lake Formation

許可權詳細

此原則包含下列權限。

  • s3:ListAllMyBuckets— 傳回要求已驗證寄件者所擁有之所有值區的清單。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "LakeFormationDataAccessServiceRolePolicy", "Effect": "Allow", "Action": [ "s3:ListAllMyBuckets" ], "Resource": [ "arn:aws:s3:::*" ] } ] }
Lake Formation AWS 管理政策的更新

檢視自此服務開始追蹤這些變更以來,對 Lake Formation AWS 管理政策的更新相關詳細資訊。

變更 描述 日期
Lake Formation 更新AWSLakeFormationCrossAccountManager政策。 Lake Formation 通過在AWSLakeFormationCrossAccountManager政策聲明中添加 Sid 元素來增強了政策。 2024 年三月
Lake Formation 更新AWSLakeFormationDataAdmin政策。 Lake Formation 透過將 Sid 元素新增至AWSLakeFormationDataAdmin政策陳述式並移除多餘動作,藉此增強了政策。 2024 年三月
Lake Formation 更新LakeFormationDataAccessServiceRolePolicy政策。 Lake Formation 通過在LakeFormationDataAccessServiceRolePolicy策略聲明中添加 Sid 元素來增強了策略。 2024年2月份
Lake Formation 更新AWSLakeFormationCrossAccountManager政策。 Lake Formation 通過添加新的權限來在混合訪問模式下啟用跨帳戶數據共享來增強了AWSLakeFormationCrossAccountManager政策。 2023 年十月
Lake Formation 更新AWSLakeFormationCrossAccountManager政策。 Lake Formation 增強了AWSLakeFormationCrossAccountManager策略,以便在首次共用資源時,每個收件者帳號僅建立一個資源共用。之後使用相同帳號共用的所有資源都會附加至相同的資源共用。 2022 年 5 月 6 日
Lake Formation 開始跟踪變化。 Lake Formation 開始跟踪其 AWS 管理政策的變化。 2022 年 5 月 6 日

人物角色建議的權限

以下是每個角色的建議權限。不包括 IAM 管理員,因為該使用者擁有所有資源的所有權限。

資料湖管理員權限

重要

在下列策略中,請以<account-id>有效的 AWS 帳號取代,並取代為<workflow_role>具有執行工作流程權限的角色名稱 (如中所定義) 工作流角色權限

政策類型 政策
AWS 受管理政策
  • AWSLakeFormationDataAdmin

  • LakeFormationDataAccessServiceRolePolicy(服務連結角色政策)

  • AWSGlueConsoleFullAccess (選用)

  • CloudWatchLogsReadOnlyAccess (選用)

  • AWSLakeFormationCrossAccountManager (選用)

  • AmazonAthenaFullAccess (選用)

如需選擇性 AWS 受管理原則的相關資訊,請參閱建立資料湖管理員

內聯政策(用於創建 Lake Formation 服務鏈接角色)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "iam:CreateServiceLinkedRole", "Resource": "*", "Condition": { "StringEquals": { "iam:AWSServiceName": "lakeformation.amazonaws.com" } } }, { "Effect": "Allow", "Action": [ "iam:PutRolePolicy" ], "Resource": "arn:aws:iam::<account-id>:role/aws-service-role/lakeformation.amazonaws.com/AWSServiceRoleForLakeFormationDataAccess" } ] }
(選擇性) 內嵌原則 (工作流程角色的密碼原則)。只有在資料湖管理員建立並執行工作流程時,才需要這樣做。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PassRolePermissions", "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::<account-id>:role/<workflow_role>" ] } ] }
(可選)內嵌政策(如果您的帳戶正在授予或接收跨帳戶 Lake Formation 權限)。此原則適用於接受或拒絕 AWS RAM 資源共用邀請,以及允許授與跨帳號權限給組織。 ram:EnableSharingWithAwsOrganization只有 AWS Organizations 管理帳戶中的資料湖管理員才需要。
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ram:AcceptResourceShareInvitation", "ram:RejectResourceShareInvitation", "ec2:DescribeAvailabilityZones", "ram:EnableSharingWithAwsOrganization" ], "Resource": "*" } ] }

唯讀管理員權限

Policy type (政策類型) 政策
內嵌原則 (基本)
{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":[ "lakeformation:GetEffectivePermissionsForPath", "lakeformation:ListPermissions", "lakeformation:ListDataCellsFilter", "lakeformation:GetDataCellsFilter", "lakeformation:SearchDatabasesByLFTags", "lakeformation:SearchTablesByLFTags", "lakeformation:GetLFTag", "lakeformation:ListLFTags", "lakeformation:GetResourceLFTags", "lakeformation:ListLakeFormationOptins", "cloudtrail:DescribeTrails", "cloudtrail:LookupEvents", "glue:GetDatabase", "glue:GetDatabases", "glue:GetConnections", "glue:SearchTables", "glue:GetTable", "glue:GetTableVersions", "glue:GetPartitions", "glue:GetTables", "glue:GetWorkflow", "glue:ListWorkflows", "glue:BatchGetWorkflows", "glue:GetWorkflowRuns", "glue:GetWorkflow", "s3:ListBucket", "s3:GetBucketLocation", "s3:ListAllMyBuckets", "s3:GetBucketAcl", "iam:ListUsers", "iam:ListRoles", "iam:GetRole", "iam:GetRolePolicy" ], "Resource":"*" }, { "Effect":"Deny", "Action":[ "lakeformation:PutDataLakeSettings" ], "Resource":"*" } ] }

資料工程師權限

重要

在下列策略中,請以<account-id>有效的 AWS 帳號取代,並取代為<workflow_role>工作流程角色的名稱。

政策類型 政策
AWS 受管理政策 AWSGlueConsoleFullAccess
內嵌原則 (基本)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "lakeformation:GetDataAccess", "lakeformation:GrantPermissions", "lakeformation:RevokePermissions", "lakeformation:BatchGrantPermissions", "lakeformation:BatchRevokePermissions", "lakeformation:ListPermissions", "lakeformation:AddLFTagsToResource", "lakeformation:RemoveLFTagsFromResource", "lakeformation:GetResourceLFTags", "lakeformation:ListLFTags", "lakeformation:GetLFTag", "lakeformation:SearchTablesByLFTags", "lakeformation:SearchDatabasesByLFTags", "lakeformation:GetWorkUnits", "lakeformation:GetWorkUnitResults", "lakeformation:StartQueryPlanning", "lakeformation:GetQueryState", "lakeformation:GetQueryStatistics" ], "Resource": "*" } ] }
內嵌政策 (適用於受控資料表上的作業,包括交易中的作業)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "lakeformation:StartTransaction", "lakeformation:CommitTransaction", "lakeformation:CancelTransaction", "lakeformation:ExtendTransaction", "lakeformation:DescribeTransaction", "lakeformation:ListTransactions", "lakeformation:GetTableObjects", "lakeformation:UpdateTableObjects", "lakeformation:DeleteObjectsOnCancel" ], "Resource": "*" } ] }
內嵌原則 (適用於使用以 Lake Formation 標記為基礎的存取控制 (LF-TBAC) 方法的中繼資料存取控制)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "lakeformation:AddLFTagsToResource", "lakeformation:RemoveLFTagsFromResource", "lakeformation:GetResourceLFTags", "lakeformation:ListLFTags", "lakeformation:GetLFTag", "lakeformation:SearchTablesByLFTags", "lakeformation:SearchDatabasesByLFTags" ], "Resource": "*" } ] }
內嵌原則 (工作流程角色的密碼原則)
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PassRolePermissions", "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::<account-id>:role/<workflow_role>" ] } ] }

資料分析師權限

政策類型 政策
AWS 受管理政策 AmazonAthenaFullAccess
內嵌原則 (基本)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "lakeformation:GetDataAccess", "glue:GetTable", "glue:GetTables", "glue:SearchTables", "glue:GetDatabase", "glue:GetDatabases", "glue:GetPartitions", "lakeformation:GetResourceLFTags", "lakeformation:ListLFTags", "lakeformation:GetLFTag", "lakeformation:SearchTablesByLFTags", "lakeformation:SearchDatabasesByLFTags" ], "Resource": "*" } ] }
(選擇性) 內嵌政策 (適用於受控資料表上的作業,包括交易內的作業)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "lakeformation:StartTransaction", "lakeformation:CommitTransaction", "lakeformation:CancelTransaction", "lakeformation:ExtendTransaction", "lakeformation:DescribeTransaction", "lakeformation:ListTransactions", "lakeformation:GetTableObjects", "lakeformation:UpdateTableObjects", "lakeformation:DeleteObjectsOnCancel" ], "Resource": "*" } ] }

工作流角色權限

此角色具有執行工作流程所需的權限。建立工作流程時,您可以指定具有這些權限的角色。

重要

在下列政策中,請以<region>有效的 AWS 區域識別碼 (例如us-east-1) 取代<account-id>為有效的 AWS 帳戶號碼、<workflow_role>工作流程角色的名稱,以及 AWS CloudTrail <your-s3-cloudtrail-bucket>日誌的 Amazon S3 路徑。

政策類型 政策
AWS 受管理政策 AWSGlueServiceRole
內嵌政策 (資料存取)
{ "Version": "2012-10-17", "Statement": [ { "Sid": "Lakeformation", "Effect": "Allow", "Action": [ "lakeformation:GetDataAccess", "lakeformation:GrantPermissions" ], "Resource": "*" } ] }
內嵌原則 (工作流程角色的密碼原則)
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PassRolePermissions", "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::<account-id>:role/<workflow_role>" ] } ] }
內嵌政策 (用於擷取資料湖外的資料,例如 AWS CloudTrail 記錄)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": ["s3:GetObject", "s3:ListBucket"], "Resource": ["arn:aws:s3:::<your-s3-cloudtrail-bucket>/*"] } ] }