Lake Formation 角色和 IAM 权限参考 - Amazon Lake Formation
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

Lake Formation 角色和 IAM 权限参考

本部分列出了一些建议的 Lake Formation 角色及其建议的 Amazon Identity and Access Management (IAM) 权限。有关 Lake Formation 权限的信息,请参阅 Lake Formation 权限参考

Amazon Lake Formation 人物角色

下表列出了建议 Amazon Lake Formation 的角色。

Lake Formation 角色
角色 描述
IAM 管理员(超级用户) (必填)可以创建 IAM 用户和角色的用户。有AdministratorAccess Amazon 托管策略。具有对所有 Lake Formation 资源的所有权限。可以添加数据湖管理员。如果未同时指定数据湖管理员,则无法授予 Lake Formation 权限。
数据湖管理员 (必填)可以注册 Amazon S3 地点、访问数据目录、创建数据库、创建和运行工作流程、向其他用户授予 Lake Formation 权限以及查看 Amazon CloudTrail 日志的用户。与 IAM 管理员相比,具有的 IAM 权限较少,但足以管理数据湖。无法添加其他数据湖管理员。
只读管理员 (可选)可以查看主体、数据目录资源、权限和 Amazon CloudTrail 日志但无权进行更新的用户。
数据工程师 (可选)可以创建数据库、创建和运行爬网程序和工作流,以及授予对爬网程序和工作流创建的数据目录表的 Lake Formation 权限的用户。我们建议您将所有数据工程师设置为数据库创建者。有关更多信息,请参阅创建数据库
数据分析人员 (可选)可以使用 Amazon Athena等对数据湖运行查询的用户。只有足够的权限来运行查询。
工作流角色 (必需)代表用户运行工作流的角色。您可以在从蓝图创建工作流时指定此角色。

Amazon Lake Formation 的托管策略

您可以使用 Amazon 托管策略和内联策略授予使用所需 Amazon Lake Formation 的 Amazon Identity and Access Management (IAM) 权限。以下 Amazon 托管策略适用于 Lake Formation。

Amazon 托管策略:AWSLakeFormationDataAdmin

AWSLakeFormationDataAdmin策略授予对管理数据湖 Amazon Lake Formation 等 Amazon Glue 相关服务的管理权限。

您可以将 AWSLakeFormationDataAdmin 附加到您的用户、组和角色。

权限详细信息

  • CloudTrail— 允许委托人查看 Amazon CloudTrail 日志。这是检查数据湖设置中的任何错误所必需的权限。

  • Glue - 允许主体查看、创建和更新数据目录中的元数据表和数据库。这包括以 GetListCreateUpdateDeleteSearch 开头的 API 操作。这是管理数据湖表的元数据所必需的权限。

  • IAM - 允许主体检索有关 IAM 用户、角色和附加到角色的策略的信息。这是数据管理员查看和列出 IAM 用户和角色以授予 Lake Formation 权限所必需的。

  • Lake Formation - 向数据湖管理员授予管理数据湖所需的 Lake Formation 权限。

  • S3 - 允许主体检索有关 Amazon S3 存储桶及其位置的信息,以便为数据湖设置数据位置。

{ "Version": "2012-10-17", "Statement": [ { "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:GetWorkflow", "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": "*" }, { "Effect": "Deny", "Action": [ "lakeformation:PutDataLakeSettings" ], "Resource": "*" } ] }
注意

AWSLakeFormationDataAdmin 策略不会向数据湖管理员授予所有必需的权限。需要额外的权限才能创建和运行工作流并向服务相关角色 AWSServiceRoleForLakeFormationDataAccess 注册位置。有关更多信息,请参阅 创建数据湖管理员在 Lake Formation 中使用服务相关角色

Amazon 托管策略:AWSLakeFormationCrossAccountManager

AWSLakeFormationCrossAccountManager策略提供通过 Lake Formation 对 Amazon Glue 资源的跨账户访问权限,并授予对其他必需服务(例如 Amazon Organizations 和)的读取权限 Amazon RAM。

您可以将 AWSLakeFormationCrossAccountManager 附加到您的用户、组和角色。

权限详细信息

该策略包含以下权限。

  • Glue - 允许主体设置或删除用于访问控制的数据目录资源策略。

  • Organizations - 允许主体检索组织的账户和组织单位 (OU) 信息。

  • ram:CreateResourceShare - 允许主体创建资源共享。

  • ram:UpdateResourceShare - 允许主体修改指定资源共享的某些属性。

  • ram:DeleteResourceShare - 允许主体删除指定的资源共享。

  • ram:AssociateResourceShare - 允许主体将指定的主体列表和资源列表添加到资源共享。

  • ram:DisassociateResourceShare - 允许主体将指定的主体或资源从参与指定资源共享中移除。

  • ram:GetResourceShares – 允许主体检索有关您拥有的或与您共享的资源共享的详细信息。

  • ram:RequestedResourceType - 允许主体检索资源类型(数据库、表或目录)。

  • AssociateResourceSharePermission— 允许委托人添加或替换资源共享中包含的资源类型的 Amazon RAM 权限。您只能将一个权限与资源共享中包含的每种资源类型相关联。

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

Amazon 托管策略:AWSGlueConsoleFullAccess

AWSGlueConsoleFullAccess当策略所关联的身份使用时,策略会授予对 Amazon Glue 资源的完全访问权限 Amazon Web Services Management Console。如果遵循此策略中指定的资源的命名约定,则用户具有完全控制台功能。此策略通常附加到 Amazon Glue 控制台的用户。

此外,Amazon GlueLake Formation 还担任服务角色,AWSGlueServiceRole允许访问相关服务,包括亚马逊弹性计算云 (Amazon EC2)、亚马逊简单存储服务 (Amazon S3) Simple Storage S3 和亚马逊。 CloudWatch

Amazon managed policy:LakeFormationDataAccessServiceRolePolicy

此策略附加到名为的服务相关角色ServiceRoleForLakeFormationDataAccess,该角色允许服务根据您的请求对资源执行操作。您不能将此策略附加到您的 IAM 身份。

该政策允许 Lake Formation 集成 Amazon 服务(例如 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 更新 Amazon 了托管政策

查看自该服务开始追踪 Lake Formation Amazon 托管政策变更以来这些更新的详细信息。

更改 描述 日期
Lake Formation 更新了 LakeFormationDataAccessServiceRolePolicy 策略。 Lake Formation在LakeFormationDataAccessServiceRolePolicy政策声明中添加了Sid元素,从而增强了该政策。 2024年2月
Lake Formation 更新了 AWSLakeFormationCrossAccountManager 策略。 Lake Formation 增加了在混合访问模式下启用跨账户数据共享的新权限,从而增强了该AWSLakeFormationCrossAccountManager政策。 2023 年 10 月
Lake Formation 更新了 AWSLakeFormationCrossAccountManager 策略。 Lake Formation 增强了AWSLakeFormationCrossAccountManager政策,在首次共享资源时,每个接收者账户仅创建一个资源共享。此后与同一账户共享的所有资源都将附加到同一资源共享。 2022 年 5 月 6 日
Lake Formation 开启了跟踪更改。 Lake Formation开始跟踪其 Amazon 托管政策的变更。 2022 年 5 月 6 日

角色建议的权限

以下是针对每个角色建议的权限。IAM 管理员不包括在内,因为该类用户具有对所有资源的所有权限。

数据湖管理员权限

重要

在以下策略中,<account-id>替换为有效的 Amazon 账号,然后<workflow_role>替换为有权运行工作流程的角色的名称,如中所定义工作流角色权限

策略类型 Policy
Amazon 托管策略
  • AWSLakeFormationDataAdmin

  • LakeFormationDataAccessServiceRolePolicy(服务相关角色策略)

  • AWSGlueConsoleFullAccess(可选)

  • CloudWatchLogsReadOnlyAccess(可选)

  • AWSLakeFormationCrossAccountManager(可选)

  • AmazonAthenaFullAccess(可选)

有关可选 Amazon 托管策略的信息,请参阅创建数据湖管理员

内联策略(用于创建 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" } ] }
(可选)内联策略(工作流角色的 passrole 策略)。仅当数据湖管理员创建并运行工作流时,才需要此策略。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PassRolePermissions", "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::<account-id>:role/<workflow_role>" ] } ] }
(可选)内联策略(如果您的账户要授予或接收跨账户 Lake Formation 权限)。此政策用于接受或拒绝 Amazon RAM 资源共享邀请,以及允许向组织授予跨账户权限。 ram:EnableSharingWithAwsOrganization只有 Amazon Organizations 管理账户中的数据湖管理员才需要填写。
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ram:AcceptResourceShareInvitation", "ram:RejectResourceShareInvitation", "ec2:DescribeAvailabilityZones", "ram:EnableSharingWithAwsOrganization" ], "Resource": "*" } ] }

只读管理员权限

策略类型 Policy
内联策略(基本)
{ "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:ListLakeFormationOptin", "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>替换为有效的 Amazon 账号,然后<workflow_role>替换为工作流程角色的名称。

策略类型 Policy
Amazon 托管策略 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": "*" } ] }
内联策略(工作流角色的 passrole 策略)
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PassRolePermissions", "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::<account-id>:role/<workflow_role>" ] } ] }

数据分析师权限

策略类型 Policy
Amazon 托管策略 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>使用有效的 Amazon 区域标识符(例如us-east-1)、<account-id>有效的 Amazon 账号、<workflow_role>工作流程角色的名称以及 Amazon CloudTrail <your-s3-cloudtrail-bucket>日志的 Amazon S3 路径替换。

策略类型 Policy
Amazon 托管策略 AWSGlueServiceRole
内联策略(数据访问)
{ "Version": "2012-10-17", "Statement": [ { "Sid": "Lakeformation", "Effect": "Allow", "Action": [ "lakeformation:GetDataAccess", "lakeformation:GrantPermissions" ], "Resource": "*" } ] }
内联策略(工作流角色的 passrole 策略)
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PassRolePermissions", "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::<account-id>:role/<workflow_role>" ] } ] }
内联策略(用于在数据湖之外提取数据, Amazon CloudTrail 例如日志)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": ["s3:GetObject", "s3:ListBucket"], "Resource": ["arn:aws:s3:::<your-s3-cloudtrail-bucket>/*"] } ] }