

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

# Lake Formation 角色和 IAM 权限参考
<a name="permissions-reference"></a>

本部分列出了一些建议的 Lake Formation 角色及其建议的 AWS Identity and Access Management (IAM) 权限。有关 Lake Formation 权限的信息，请参阅 [Lake Formation 权限参考](lf-permissions-reference.md)。

## AWS Lake Formation 角色
<a name="lf-personas"></a>

下表列出了建议 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 权限的用户。我们建议您将所有数据工程师设置为数据库创建者。有关更多信息，请参阅 [创建数据库](creating-database.md)。 | 
| 数据分析人员 | （可选）可以使用 Amazon Athena等对数据湖运行查询的用户。只有足够的权限来运行查询。 | 
| 工作流角色 | （必需）代表用户运行工作流的角色。您可以在从蓝图创建工作流时指定此角色。 | 

**注意**  
在 Lake Formation 中，创建数据库后添加的数据湖管理员可以授予权限，但不会自动拥有诸如 SELECT 或 DESCRIBE 之类的数据访问权限。创建数据库的管理员将获得这些数据库的 `SUPER` 权限。这种行为是刻意设计的，尽管所有管理员都可以向自己授予所需的权限，但这些权限不会自动应用于先前存在的资源。因此，管理员必须明确向自己授予在获授管理员权限之前存在的数据库的访问权限。

## AWS Lake Formation 的托管策略
<a name="lf-managed-policies"></a>

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

### AWS 托管策略：AWSLakeFormationDataAdmin
<a name="lf-data-admin"></a>

 [AWSLakeFormationDataAdmin](https://console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSLakeFormationDataAdmin)策略授予对管理数据湖 AWS Lake Formation 等 AWS Glue 相关服务的管理权限。

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

**权限详细信息**
+ `CloudTrail`— 允许委托人查看 AWS CloudTrail 日志。这是检查数据湖设置中的任何错误所必需的权限。
+ `Glue` - 允许主体查看、创建和更新数据目录中的元数据表和数据库。这包括以 `Get`、`List`、`Create`、`Update`、`Delete` 和 `Search` 开头的 API 操作。这是管理数据湖表的元数据所必需的权限。
+ `IAM` - 允许主体检索有关 IAM 用户、角色和附加到角色的策略的信息。这是数据管理员查看和列出 IAM 用户和角色以授予 Lake Formation 权限所必需的。
+ `Lake Formation` - 向数据湖管理员授予管理数据湖所需的 Lake Formation 权限。
+ `S3` - 允许主体检索有关 Amazon S3 存储桶及其位置的信息，以便为数据湖设置数据位置。

```
"Statement": [
        {
            "Sid": "AWSLakeFormationDataAdminAllow",
            "Effect": "Allow",
            "Action": [
                "lakeformation:*",
                "cloudtrail:DescribeTrails",
                "cloudtrail:LookupEvents",
                "glue:CreateCatalog",
		"glue:UpdateCatalog",
                "glue:DeleteCatalog",
		"glue:GetCatalog",
	        "glue:GetCatalogs",
                "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` 注册位置。有关更多信息，请参阅[创建数据湖管理员](initial-lf-config.md#create-data-lake-admin)和[在 Lake Formation 中使用服务相关角色](service-linked-roles.md)。

### AWS 托管策略：AWSLakeFormationCrossAccountManager
<a name="lf-cross-account-manager"></a>

[AWSLakeFormationCrossAccountManager](https://console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/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 权限。您只能将一个权限与资源共享中包含的每种资源类型相关联。

------
#### [ JSON ]

****  

```
{
    "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": {
                "ArnLike": {
                    "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
<a name="glue-console-access-policy"></a>

[AWSGlueConsoleFullAccess](https://console.aws.amazon.com/iam/home#policies/arn:aws:iam::aws:policy/AWSGlueConsoleFullAccess)当策略所关联的身份使用时，策略会授予对 AWS Glue 资源的完全访问权限 AWS 管理控制台。如果遵循此策略中指定的资源的命名约定，则用户具有完全控制台功能。此策略通常附加到 AWS Glue 控制台的用户。

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

### AWS managed policy:LakeFormationDataAccessServiceRolePolicy
<a name="lake-formation-data-access-service-role-policy"></a>

此策略附加到名为 `ServiceRoleForLakeFormationDataAccess` 的服务相关角色，以允许服务根据您的请求对资源执行操作。无法将此策略附加到 IAM 身份。

该政策允许 Lake Formation 集成 AWS 服务（例如 Amazon Athena 或 Amazon Redshift）使用服务相关角色来发现亚马逊 S3 资源。

有关更多信息，请参阅[在 Lake Formation 中使用服务相关角色](service-linked-roles.md)。

**权限详细信息**

此策略包含以下权限。
+ `s3:ListAllMyBuckets` – 返回已经过身份验证的请求发送者所拥有的所有存储桶列表。

------
#### [ JSON ]

****  

```
{
	"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 Form [AWSLakeFormationCrossAccountManager](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSLakeFormationCrossAccountManager)ation 将StringLike条件运算符替换为允许 IAM 执行 ARN 格式检查的ArnLike运算符，从而增强了该策略。 | 2025 年 1 月 | 
| Lake Formation 更新了 AWSLakeFormationDataAdmin 策略。 | Lake Formation 在多目录功能中添加了 APIs 以下 AWS Glue Data Catalog CRUD，从而增强了该[AWSLakeFormationDataAdmin](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSLakeFormationDataAdmin)政策。[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lake-formation/latest/dg/permissions-reference.html)此托管策略变更旨在确保 Lake Formation 管理员角色在默认情况下对这些新操作拥有 IAM 权限。 | 2024 年 12 月 | 
| Lake Formation 更新了 AWSLakeFormationCrossAccountManager 策略。 | Lake Formati [AWSLakeFormationCrossAccountManager](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSLakeFormationCrossAccountManager)on在政策声明中添加了Sid元素，从而增强了该政策。 | 2024 年 3 月 | 
| Lake Formation 更新了 AWSLakeFormationDataAdmin 策略。 | Lake Formation 在[AWSLakeFormationDataAdmin](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSLakeFormationDataAdmin)政策声明中添加了 Sid 元素并删除了多余的操作，从而增强了该政策。 | 2024 年 3 月 | 
| Lake Formation 更新了 LakeFormationDataAccessServiceRolePolicy 策略。 | Lake Formation在[LakeFormationDataAccessServiceRolePolicy](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/LakeFormationDataAccessServiceRolePolicy)政策声明中添加了Sid元素，从而增强了该政策。 | 2024 年 2 月 | 
| Lake Formation 更新了 AWSLakeFormationCrossAccountManager 策略。 | Lake Formation 增加了在混合访问模式下启用跨账户数据共享的新权限，从而增强了该[AWSLakeFormationCrossAccountManager](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSLakeFormationCrossAccountManager)政策。 | 2023 年 10 月 | 
| Lake Formation 更新了 AWSLakeFormationCrossAccountManager 策略。 | Lake Formation 增强了[AWSLakeFormationCrossAccountManager](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSLakeFormationCrossAccountManager)政策，在首次共享资源时，每个接收者账户仅创建一个资源共享。此后与同一账户共享的所有资源都将附加到同一资源共享。 | 2022 年 5 月 6 日 | 
| Lake Formation 开启了跟踪更改。 | Lake Formation开始跟踪其 AWS 托管政策的变更。 | 2022 年 5 月 6 日 | 

## 角色建议的权限
<a name="lf-permissions-tables"></a>

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

**Topics**
+ [数据湖管理员权限](#persona-dl-admin)
+ [只读管理员权限](#persona-read-only-admin)
+ [数据工程师权限](#persona-engineer)
+ [数据分析师权限](#persona-user)
+ [工作流角色权限](#persona-workflow-role)

### 数据湖管理员权限
<a name="persona-dl-admin"></a>

**重要**  
在以下策略中，*<account-id>*替换为有效的 AWS 账号，然后*<workflow\$1role>*替换为有权运行工作流程的角色的名称，如中所定义[工作流角色权限](#persona-workflow-role)。


| 策略类型 | Policy | 
| --- | --- | 
| AWS 托管策略 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lake-formation/latest/dg/permissions-reference.html) 有关可选 AWS 托管策略的信息，请参阅[创建数据湖管理员](initial-lf-config.md#create-data-lake-admin)。  | 
| 内联策略（用于创建 Lake Formation 服务相关角色） |  <pre>{<br />    "Version": "2012-10-17",		 	 	 <br />    "Statement": [<br />        {<br />            "Effect": "Allow",<br />            "Action": "iam:CreateServiceLinkedRole",<br />            "Resource": "*",<br />            "Condition": {<br />                "StringEquals": {<br />                    "iam:AWSServiceName": "lakeformation.amazonaws.com"<br />                }<br />            }<br />        },<br />        {<br />            "Effect": "Allow",<br />            "Action": [<br />                "iam:PutRolePolicy"<br />            ],<br />            "Resource": "arn:aws:iam::<account-id>:role/aws-service-role/lakeformation.amazonaws.com/AWSServiceRoleForLakeFormationDataAccess"<br />        }<br />    ]<br />}<br /></pre>  | 
| （可选）内联策略（工作流角色的 passrole 策略）。仅当数据湖管理员创建并运行工作流时，才需要此策略。 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lake-formation/latest/dg/permissions-reference.html)  | 
| （可选）内联策略（如果您的账户要授予或接收跨账户 Lake Formation 权限）。此政策用于接受或拒绝 AWS RAM 资源共享邀请，以及允许向组织授予跨账户权限。 ram:EnableSharingWithAwsOrganization只有 AWS Organizations 管理账户中的数据湖管理员才需要使用。 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lake-formation/latest/dg/permissions-reference.html)  | 

### 只读管理员权限
<a name="persona-read-only-admin"></a>


| 策略类型 | Policy | 
| --- | --- | 
| 内联策略（基本） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lake-formation/latest/dg/permissions-reference.html)  | 

### 数据工程师权限
<a name="persona-engineer"></a>

**重要**  
在以下策略中，*<account-id>*替换为有效的 AWS 账号，然后*<workflow\$1role>*替换为工作流程角色的名称。


| 策略类型 | Policy | 
| --- | --- | 
| AWS 托管策略 | AWSGlueConsoleFullAccess | 
| 内联策略（基本） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lake-formation/latest/dg/permissions-reference.html)  | 
| 内联策略（用于对受管控表的操作，包括事务中的操作） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lake-formation/latest/dg/permissions-reference.html)  | 
| 内联策略（用于使用 Lake Formation 基于标签的访问控制 (LF-TBAC) 方法进行元数据访问控制） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lake-formation/latest/dg/permissions-reference.html)  | 
| 内联策略（工作流角色的 passrole 策略） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lake-formation/latest/dg/permissions-reference.html)  | 

### 数据分析师权限
<a name="persona-user"></a>


| 策略类型 | Policy | 
| --- | --- | 
| AWS 托管策略 | AmazonAthenaFullAccess | 
| 内联策略（基本） |  <pre>{<br />    "Version": "2012-10-17",		 	 	 <br />    "Statement": [<br />        {<br />            "Effect": "Allow",<br />            "Action": [<br />                "lakeformation:GetDataAccess",<br />                "glue:GetTable",<br />                "glue:GetTables",<br />                "glue:SearchTables",<br />                "glue:GetDatabase",<br />                "glue:GetDatabases",<br />                "glue:GetPartitions",<br />                "lakeformation:GetResourceLFTags",<br />                "lakeformation:ListLFTags",<br />                "lakeformation:GetLFTag",<br />                "lakeformation:SearchTablesByLFTags",<br />                "lakeformation:SearchDatabasesByLFTags"                <br />           ],<br />            "Resource": "*"<br />        }<br />    ]<br />}</pre>  | 
| （可选）内联策略（用于对受管控表的操作，包括事务中的操作） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lake-formation/latest/dg/permissions-reference.html)  | 

### 工作流角色权限
<a name="persona-workflow-role"></a>

该角色具有运行工作流所需的权限。创建工作流时，您可以指定具有这些权限的角色。

**重要**  
在以下策略中，*<region>*使用有效的 AWS 区域标识符（例如`us-east-1`）、*<account-id>*有效的 AWS 账号、工作流程角色的*<workflow\$1role>*名称以及*<your-s3-cloudtrail-bucket>* AWS CloudTrail 日志的 Amazon S3 路径替换。


| 策略类型 | Policy | 
| --- | --- | 
| AWS 托管策略 | AWSGlueServiceRole  | 
| 内联策略（数据访问） |  <pre>{<br />    "Version": "2012-10-17",		 	 	 <br />    "Statement": [<br />        {<br />            "Sid": "Lakeformation",<br />            "Effect": "Allow",<br />            "Action": [<br />                 "lakeformation:GetDataAccess",<br />                 "lakeformation:GrantPermissions"<br />             ],<br />            "Resource": "*"<br />        }<br />    ]<br />}</pre>  | 
| 内联策略（工作流角色的 passrole 策略） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lake-formation/latest/dg/permissions-reference.html)  | 
| 内联策略（用于在数据湖之外提取数据， AWS CloudTrail 例如日志） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lake-formation/latest/dg/permissions-reference.html)  | 