Get started with simplified trusted identity propagation
To use simplified trusted identity propagation with Amazon EMR on EC2, enable a downstream service, choose a path, and complete the setup for your cluster. After setup, identity propagation applies automatically on supported releases.
Before you begin
Before you start, enable at least one downstream service that authorizes on identity, such as AWS Lake Formation, Amazon S3 Access Grants, and S3 table grants. That service is what enforces the propagated identity.
In-transit encryption must be enabled in the cluster's security configuration. For more information, see Encryption in transit.
Choose a path
Choose one of the following paths. You can use both paths in the same account.
- IAM Identity Center path
-
An administrator opts in once in the IAM Identity Center console. Choose Settings, choose the Identity source tab, and in the Simplified trusted identity propagation section choose Enable. The setting applies to the whole IAM Identity Center instance, so it affects every application on the instance, including Amazon SageMaker Unified Studio domains. For more information, see Enable the simplified experience in the IAM Identity Center User Guide. An instance stays on the earlier version until you opt in, and an instance cannot run both versions at once. Users and groups from your external identity provider keep synchronizing. With the earlier version, Amazon EMR created the Identity Center application for you. With the simplified version, no Identity Center application is used, and there is no further configuration in Amazon EMR beyond the cluster setup.
- IAM federation path
-
An administrator registers the identity provider in IAM, if it is not already registered, and configures a context provider that defines which attributes, such as user ID, email, and department, AWS records from the federated token. For more information, see Configure a context provider for trusted identity propagation in the IAM User Guide. Each downstream service decides how it evaluates role-based and identity-based grants. By default, authorization is based on user attributes. To authorize on groups, attach an IAM Identity Center instance to your IAM identity provider.
Set up Amazon EMR on EC2
The setup is the same for both paths. Execution roles that you already set up for the earlier version need no trust policy change.
If you are new to trusted identity propagation, review the cluster's instance profile role before you begin: the Service role for cluster EC2 instances (EC2 instance profile).
Each execution role must trust the cluster's instance profile role for
sts:AssumeRole and sts:TagSession. The following trust
policy grants this access. Replace 111122223333 with your
own account ID, and replace the role name with your instance profile
role.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::111122223333:role/EMR_EC2_DefaultRole" }, "Action": [ "sts:AssumeRole", "sts:TagSession" ] } ] }
A security configuration that already enables runtime roles needs no change, and identity propagation is always enabled on it. For more information about runtime roles, see Runtime roles for Amazon EMR steps.
The IAMConfiguration in your security configuration sets two
fields:
EnableApplicationScopedIAMRole-
A
trueorfalsesetting that turns runtime roles on or off for the cluster. DefaultApplicationScopedIAMRole-
The ARN of the IAM role that Amazon EMR uses as the runtime role for a request without an execution role, on a cluster where
EnableApplicationScopedIAMRoleisfalse.
The following example shows this IAMConfiguration with
EnableApplicationScopedIAMRole set to false:
{ "AuthorizationConfiguration": { "IAMConfiguration": { "EnableApplicationScopedIAMRole": false, "DefaultApplicationScopedIAMRole": "<IAM-Role-Arn>" } } }
For a request without an execution role, on a cluster where
EnableApplicationScopedIAMRole is false, Amazon EMR uses the
cluster's DefaultApplicationScopedIAMRole as the runtime role. If that
field isn't set, callers that use simplified trusted identity propagation fall back to
IAMRoleForEMRIdentityCenterApplicationARN on a cluster that uses IAM Identity Center, or
to the instance profile on a cluster without IAM Identity Center. When
EnableApplicationScopedIAMRole is true, Amazon EMR rejects a
request that doesn't specify an execution role.
Set EnableApplicationScopedIAMRole to false to accept
simplified trusted identity propagation credentials on a cluster that doesn't require
an execution role on every request.
The following example shows a complete security configuration, with
EnableApplicationScopedIAMRole set to false, for a cluster
that uses fine-grained access control with AWS Lake Formation. The
AuthorizedSessionTagValue must match the value that you set in Lake Formation,
including case. For the Lake Formation setup, see Enable Lake Formation with Amazon EMR.
{ "AuthorizationConfiguration": { "LakeFormationConfiguration": { "AuthorizedSessionTagValue": "Amazon EMR" }, "IAMConfiguration": { "EnableApplicationScopedIAMRole": false, "DefaultApplicationScopedIAMRole": "<IAM-Role-Arn>" } } }
Run your workloads
After setup, create sessions and submit jobs as usual. A job runs on behalf of the user who submits it. You can submit Spark batch jobs through the Steps API, run Apache Livy interactive sessions, and run Spark Connect sessions.
Background sessions and identity lifetime
Amazon EMR can keep a job attributable to a user after the user signs out, by using an IAM Identity Center background session. Background sessions are controlled at the IAM Identity Center instance level, not through an Amazon EMR setting. Amazon EMR requests a background session when work starts, or reuses one that an upstream application such as Amazon SageMaker Unified Studio created.
A new Identity Center instance has background sessions enabled by default. A migrated instance keeps its previous setting. For more information, see User background sessions in the IAM Identity Center User Guide. If background sessions are disabled, Amazon EMR falls back to an interactive session, and the workload keeps the identity only as long as the interactive sign-in session lasts.
The maximum identity lifetime is 90 days on the IAM Identity Center path. On the IAM federation path, the maximum is 90 days when you attach an IAM Identity Center instance, and 7 days when you do not.