

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

# 可信身份传播入门
<a name="security-iam-service-trusted-prop-getting-started"></a>

[本节帮助您使用 Apache Livy Endpoint 配置 EMR 无服务器应用程序，使其与 Amazon IAM 身份中心集成并启用可信身份传播。](https://docs.amazonaws.cn/singlesignon/latest/userguide/trustedidentitypropagation-overview.html)

## 先决条件
<a name="security-iam-service-trusted-prop-prereqs"></a>
+ 您要在其中创建可信身份传播的 Amazon 区域中的身份中心实例，该实例已启用 EMR Serverless Apache Livy Endpoint。一个 Amazon 账户的身份中心实例只能存在于单个区域中。请参阅[启用 IAM 身份中心并将您的身份](https://docs.amazonaws.cn/singlesignon/latest/userguide/enable-identity-center.html)[来源中的用户和群组配置到 IAM Identit](https://docs.amazonaws.cn/singlesignon/latest/userguide/tutorials.html) y Center。
+ 为交互式工作负载将与之交互的下游服务（例如 Lake Formation 或 S3 访问权限管控或 Amazon Redshift 集群）启用可信身份传播，以便访问数据。

## 创建启用了可信身份传播的 EMR Serverless 应用程序的权限
<a name="security-iam-service-trusted-prop-emrs-application"></a>

除了[访问 EMR Serverless 所需的基本权限](setting-up.html#setting-up-iam)外，您还必须为用于创建启用可信身份传播的 EMR Serverless 应用程序的 IAM 身份或角色配置其他权限。对于可信身份传播，EMR Serverless 是您账户中管理身份中心应用程序的单 creates/bootstraps 一服务，该服务利用该服务向下游进行身份验证和身份传播。

```
"sso:DescribeInstance",
"sso:CreateApplication", 
"sso:DeleteApplication",
"sso:PutApplicationAuthenticationMethod",
"sso:PutApplicationAssignmentConfiguration",  
"sso:PutApplicationGrant", 
"sso:PutApplicationAccessScope"
```
+ `sso:DescribeInstance`— 授予描述和验证您在参数中指定的 IAM Identity Center InstanceArn 的权限。 identity-center-configuration
+ `sso:CreateApplication`— 授予创建用于操作的 EMR Serverless 托管 IAM 身份中心应用程序的权限。 trusted-identity-propatgion
+ `sso:DeleteApplication`：授予清理 EMR Serverless 托管 IAM Identity Center 应用程序的权限
+ `sso:PutApplicationAuthenticationMethod`：授予在 EMR Serverless 托管 IAM Identity Center 应用程序上放置 authenticationMethod 的权限，以便 emr-serverless 服务主体与 IAM Identity Center 应用程序交互。
+ `sso:PutApplicationAssignmentConfiguration`— 授予在 IAM 身份中心应用程序上设置 ser-assignment-not-required “U” 设置的权限。
+ `sso:PutApplicationGrant`：授予在 IAM Identity Center 应用程序上应用 token-exchange、introspectToken、refreshToken 和 revokeToken 授权的权限。
+ `sso:PutApplicationAccessScope`：授予将启用可信身份传播的下游作用域应用于 IAM Identity Center 应用程序的权限。我们应用 “redshift: connect”、“lakeformation: query” 和 “s3: read\_write” 范围来启用这些服务。 trusted-identity-propagation

## 创建启用可信身份传播的 EMR Serverless 应用程序
<a name="security-iam-service-trusted-prop-create-emrs-app"></a>

您必须使用 `identityCenterInstanceArn` 指定 `—identity-center-configuration` 字段，才能在应用程序中启用可信身份传播。使用以下示例命令创建启用可信身份传播的 EMR Serverless 应用程序。

**注意**  
您还必须指定 `--interactive-configuration '{"livyEndpointEnabled":true}'`，因为仅对 Apache Livy Endpoint 启用了可信身份传播。

```
aws emr-serverless create-application \
  --release-label emr-7.8.0 \
  --type "SPARK" \
  --identity-center-configuration '{"identityCenterInstanceArn" : "arn:aws:sso:::instance/ssoins-123456789"}' \
  --interactive-configuration '{"livyEndpointEnabled":true}'
```
+ `identity-center-configuration`：（可选）启用 Identity Center 可信身份传播（如果已指定）。
+ `identityCenterInstanceArn`：（必需）Identity Center 实例 ARN。

如果您没有所需的 Identity Center 权限（如前所述），请先创建没有可信身份传播的 EMR Serverless 应用程序（例如，不要指定 `—identity-center-configuration` 参数），然后让您的 Identity Center 管理员通过调用 update-application API 来启用可信身份传播，请参见以下示例：

```
aws emr-serverless update-application \
  --application-id {{applicationId}} \
  --identity-center-configuration '{"identityCenterInstanceArn" : "arn:aws:sso:::instance/ssoins-123456789"}'
```

EMR Serverless 会在您的账户中创建一个服务托管式 Identity Center 应用程序，服务会利用该应用程序进行身份验证并将身份传播到下游服务。EMR Serverless 创建的托管身份中心应用程序将在您账户中所有启用的 trusted-identity-propagation EMR Serverless 应用程序之间共享。

**注意**  
请勿手动修改托管式 Identity Center 应用程序的设置。任何更改都可能影响您账户中所有 trusted-identity-propagation启用的 EMR Serverless 应用程序。

## 传播身份所需的作业执行角色权限
<a name="security-iam-service-trusted-prop-job-execution-role-permissions"></a>

由于 EMR-Serverless 利用身份增强型 job-execution-role凭证将身份传播到下游服务 Amazon ，因此任务执行角色的信任策略必须具有额外的权限，才能使用身份增强任务执行角色凭证，`sts:SetContext`以允许下游 trusted-identity-propagation服务（例如 S3 访问授予、Lake Formation 或 Amazon Redshift）。要了解有关如何创建角色的更多信息，请参阅[创建作业运行时角色](getting-started.html#gs-runtime-role)。

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

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
     {
     "Effect": "Allow",
     "Principal": {
     "Service": "emr-serverless.amazonaws.com"
     },
     "Action": [ "sts:AssumeRole", "sts:SetContext"]
     }
  ]
}
```

------

此外，还 JobExecutionRole 需要下游 Amazon 服务的权限，job-run 会调用这些下游服务来使用用户身份获取数据。请参阅以下链接来配置 S3 访问权限管控、Lake Formation。
+ [将 Lake Formation 与 EMR Serverless 结合使用](lake-formation-section.html)
+ [将 Amazon S3 访问权限授予与 EMR 无服务器配合使用](access-grants.html)