

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

# Trusted-Identity 傳播入門
<a name="security-iam-service-trusted-prop-getting-started"></a>

本節可協助您使用 Apache Livy 端點設定 EMR-Serverless 應用程式，以與 AWS IAM Identity Center 整合，並啟用[受信任身分傳播](https://docs.aws.amazon.com/singlesignon/latest/userguide/trustedidentitypropagation-overview.html)。

## 先決條件
<a name="security-iam-service-trusted-prop-prereqs"></a>
+ 您要在 AWS 區域中建立啟用受信任身分傳播的 EMR Serverless Apache Livy 端點的 Identity Center 執行個體。Identity Center 執行個體只能存在於 AWS 帳戶的單一區域中。請參閱[啟用 IAM Identity Center](https://docs.aws.amazon.com/singlesignon/latest/userguide/enable-identity-center.html) [和將身分來源中的使用者和群組佈建到 IAM Identity Center](https://docs.aws.amazon.com/singlesignon/latest/userguide/tutorials.html)。
+ 為 Lake Formation 或 S3 Access Grants 或 Amazon Redshift 叢集等下游服務啟用受信任身分傳播，互動式工作負載會與之互動以存取資料。

## 建立啟用受信任身分傳播的 EMR Serverless 應用程式的許可
<a name="security-iam-service-trusted-prop-emrs-application"></a>

除了[存取 EMR Serverless 所需的基本許可](setting-up.html#setting-up-iam)之外，您還必須為 IAM 身分或角色設定其他許可，用於建立啟用受信任身分傳播的 EMR Serverless 應用程式。對於受信任身分傳播，EMR Serverless 會在您的帳戶中建立/引導單一服務受管身分中心應用程式，該應用程式會利用該應用程式將身分驗證和身分傳播到下游。

```
"sso:DescribeInstance",
"sso:CreateApplication", 
"sso:DeleteApplication",
"sso:PutApplicationAuthenticationMethod",
"sso:PutApplicationAssignmentConfiguration",  
"sso:PutApplicationGrant", 
"sso:PutApplicationAccessScope"
```
+ `sso:DescribeInstance` – 准許描述和驗證您在 identity-center-configuration 參數中指定的 IAM Identity Center instanceArn。
+ `sso:CreateApplication` – 准許建立用於trusted-identity-propatgion動作的 EMR Serverless 受管 IAM Identity Center 應用程式。
+ `sso:DeleteApplication` – 准許清除 EMR Serverless 受管 IAM Identity Center 應用程式
+ `sso:PutApplicationAuthenticationMethod` – 准許在 EMR Serverless 受管 IAM Identity Center 應用程式上放置 authenticationMethod，以允許 emr-serverless 服務主體與 IAM Identity Center 應用程式互動。
+ `sso:PutApplicationAssignmentConfiguration` – 准許在 IAM Identity Center 應用程式上設定「User-assignment-not-required」設定。
+ `sso:PutApplicationGrant` – 准許在 IAM Identity Center 應用程式上套用 Token-exchange、introspectToken、refreshToken 和 revokeToken 授予。
+ `sso:PutApplicationAccessScope` – 准許將啟用信任身分傳播的下游範圍套用至 IAM Identity Center 應用程式。我們套用「redshift：connect」、「lakeformation：query」和「s3：read\$1write」範圍，以啟用這些服務的trusted-identity-propagation。

## 建立啟用信任身分傳播的 EMR Serverless 應用程式
<a name="security-iam-service-trusted-prop-create-emrs-app"></a>

您必須使用 指定`—identity-center-configuration`欄位`identityCenterInstanceArn`，才能在應用程式中啟用信任身分傳播。使用以下範例命令建立已啟用信任身分傳播的 EMR Serverless 應用程式。

**注意**  
您也必須將 指定`--interactive-configuration '{"livyEndpointEnabled":true}'`為僅針對 Apache Livy 端點啟用受信任身分傳播。

```
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 Admin 透過叫用更新應用程式 API 來啟用信任身分傳播，請參閱下列範例：

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

EMR Serverless 會在您的帳戶中建立服務受管身分中心應用程式，服務會利用該應用程式來驗證身分，並將身分傳播到下游服務。EMR Serverless 建立的受管 Identity Center 應用程式會與您帳戶中所有啟用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 利用 Identity-enhanced job-execution-role 登入資料將身分傳播到下游 AWS 服務，因此 Job Execution Role 的 Trust-policy 必須具有額外的許可`sts:SetContext`，以使用身分增強任務執行角色登入資料，以允許受trusted-identity-propagation到下游服務，例如 S3 Access-grant、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 需要下游 AWS 服務的許可，其任務執行會使用使用者身分來擷取資料。請參閱以下連結來設定 S3 Access Grant、Lake Formation。
+ [搭配 EMR Serverless 使用 Lake Formation](lake-formation-section.html)
+ [搭配 EMR Serverless 使用 Amazon S3 Access Grants](access-grants.html)