

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

# 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 角色**  

| 人物 | Description | 
| --- | --- | 
| IAM 管理員 （超級使用者） | （必要） 可建立 IAM 使用者和角色的使用者。具有 AdministratorAccess AWS 受管政策。具有所有 Lake Formation 資源的所有許可。可以新增資料湖管理員。如果也未指定資料湖管理員，則無法授予 Lake Formation 許可。 | 
| 資料湖管理員 | （必要） 可註冊 Amazon S3 位置、存取 Data Catalog、建立資料庫、建立和執行工作流程、將 Lake Formation 許可授予其他使用者，以及檢視 AWS CloudTrail 日誌的使用者。IAM 許可少於 IAM 管理員，但足以管理資料湖。無法新增其他資料湖管理員。 | 
| 唯讀管理員 | （選用） 可檢視主體、Data Catalog 資源、許可和 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` – 允許主體檢視、建立和更新 Data Catalog 中的中繼資料表和資料庫。這包括以 `Get`、`List`、、`Delete`、 `Create` `Update`和 開頭的 API 操作`Search`。這是管理資料湖資料表中繼資料的必要項目。
+ `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` – 允許主體設定或刪除 Data Catalog 資源政策以進行存取控制。
+ `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 Elastic Compute Cloud (Amazon EC2)、Amazon Simple Storage Service (Amazon S3) 和 Amazon CloudWatch。

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

此政策會連接到名為 的服務連結角色`ServiceRoleForLakeFormationDataAccess`，該角色允許服務在您請求時對資源執行動作。您無法將此政策連接至您的 IAM 身分。

此政策允許 Lake Formation 整合 AWS 服務，例如 Amazon Athena 或 Amazon Redshift，使用服務連結角色來探索 Amazon 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:::*"
			]
		}
	]
}
```

------

**AWS 受管政策的 Lake Formation 更新**  
檢視自此服務開始追蹤這些變更以來，Lake Formation AWS 受管政策更新的詳細資訊。


| 變更 | 描述 | Date | 
| --- | --- | --- | 
| Lake Formation 已更新AWSLakeFormationCrossAccountManager政策。 | Lake Formation 透過將StringLike條件運算子取代為允許 IAM 執行 ARN 格式檢查的運算ArnLike子，增強了 [AWSLakeFormationCrossAccountManager](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSLakeFormationCrossAccountManager) 政策。 | 2025 年 1 月 | 
| Lake Formation 已更新AWSLakeFormationDataAdmin政策。 | Lake Formation 新增下列 AWS Glue Data Catalog CRUD APIs做為多目錄功能的一部分，增強了 [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_tw/lake-formation/latest/dg/permissions-reference.html)此受管政策變更旨在確保 Lake Formation 管理員角色預設具有這些新操作的 IAM 許可。 | 2024 年 12 月 | 
| Lake Formation 已更新AWSLakeFormationCrossAccountManager政策。 | Lake Formation 透過將 Sid 元素新增至政策陳述式來增強 [AWSLakeFormationCrossAccountManager](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSLakeFormationCrossAccountManager) 政策。 | 2024 年 3 月 | 
| Lake Formation 已更新AWSLakeFormationDataAdmin政策。 | Lake Formation 透過將 Sid 元素新增至政策陳述式並移除備援動作來增強 [AWSLakeFormationDataAdmin](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSLakeFormationDataAdmin) 政策。 | 2024 年 3 月 | 
| Lake Formation 已更新LakeFormationDataAccessServiceRolePolicy政策。 | Lake Formation 透過將 Sid 元素新增至政策陳述式來增強 [LakeFormationDataAccessServiceRolePolicy](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/LakeFormationDataAccessServiceRolePolicy) 政策。 | 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**
+ [Data Lake 管理員許可](#persona-dl-admin)
+ [唯讀管理員許可](#persona-read-only-admin)
+ [資料工程師許可](#persona-engineer)
+ [資料分析師許可](#persona-user)
+ [工作流程角色許可](#persona-workflow-role)

### Data Lake 管理員許可
<a name="persona-dl-admin"></a>

**重要**  
在下列政策中，將 *<account-id>* 取代為有效的 AWS 帳號，並將 *<workflow\$1role>* 取代為具有執行工作流程許可的角色名稱，如 中所定義[工作流程角色許可](#persona-workflow-role)。


| 政策類型 | 政策 | 
| --- | --- | 
| AWS 受管政策 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/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>  | 
| （選用） 內嵌政策 （工作流程角色的通行政策）。只有在資料湖管理員建立和執行工作流程時，才需要這樣做。 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/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_tw/lake-formation/latest/dg/permissions-reference.html)  | 

### 唯讀管理員許可
<a name="persona-read-only-admin"></a>


| Policy type (政策類型) | 政策 | 
| --- | --- | 
| 內嵌政策 （基本） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lake-formation/latest/dg/permissions-reference.html)  | 

### 資料工程師許可
<a name="persona-engineer"></a>

**重要**  
在下列政策中，將 *<account-id>* 取代為有效的 AWS 帳號，並將 *<workflow\$1role>* 取代為工作流程角色的名稱。


| 政策類型 | 政策 | 
| --- | --- | 
| AWS 受管政策 | AWSGlueConsoleFullAccess | 
| 內嵌政策 （基本） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lake-formation/latest/dg/permissions-reference.html)  | 
| 內嵌政策 （適用於受管資料表上的操作，包括交易中的操作） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/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_tw/lake-formation/latest/dg/permissions-reference.html)  | 
| 內嵌政策 （工作流程角色的通行政策） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lake-formation/latest/dg/permissions-reference.html)  | 

### 資料分析師許可
<a name="persona-user"></a>


| 政策類型 | 政策 | 
| --- | --- | 
| 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_tw/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 路徑。


| 政策類型 | 政策 | 
| --- | --- | 
| 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>  | 
| 內嵌政策 （工作流程角色的通行政策） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lake-formation/latest/dg/permissions-reference.html)  | 
| 內嵌政策 （用於在資料湖外擷取資料，例如 AWS CloudTrail 日誌） |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lake-formation/latest/dg/permissions-reference.html)  | 