Get started with simplified trusted identity propagation on Amazon EMR on EKS
Complete the setup for your chosen path once. After setup is complete, identity propagation applies automatically to supported workloads on supported releases.
Before you begin
Before you start, enable at least one downstream service that authorizes on identity, because that service enforces the propagated identity. You can use any of the following:
AWS Lake Formation, for table, row, column, and cell-level access to AWS Glue Data Catalog tables.
Amazon S3 Access Grants, for prefix-level access to Amazon S3 data.
S3 table grants, for table-level access to Amazon S3 Tables.
Choose a path
The setup is the same for both paths. Choose the path that matches how your workforce users reach AWS. 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 on EKS beyond the setup that follows.
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. To authorize on groups, attach an IAM Identity Center instance to your IAM identity provider.
Set up Amazon EMR on EKS
With simplified trusted identity propagation, the job execution role trusts a system role, and the security configuration names that system role. Batch jobs now use the same setup as interactive workloads.
Step 1: Set up cluster access for Amazon EMR on EKS
Set up cluster access for Amazon EMR on EKS. Cluster access setup applies to both batch and interactive workloads. With simplified trusted identity propagation, batch jobs also need the system role for identity propagation and for fine-grained access control, the same as interactive jobs. For instructions, see Enable cluster access for Amazon EMR on EKS.
Step 2: Configure the system role
The system role tags sessions when it assumes the job execution role, assumes the job execution role, and creates the TLS certificate that Amazon EMR on EKS uses. If no system role is defined, Amazon EMR on EKS drops the identity and runs the workload without a propagated user identity.
Attach the following IAM permissions policy to the system role. This policy lets the
system role tag sessions with LakeFormationAuthorizedCaller set to
EMR on EKS Engine when it assumes the job execution role, assume the job
execution role, and create the TLS certificate.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "TagSessionAccessForSystemDriver", "Effect": "Allow", "Action": [ "sts:TagSession" ], "Resource": [ "arn:aws:iam::*:role/JobExecutionRole" ], "Condition": { "StringLike": { "aws:RequestTag/LakeFormationAuthorizedCaller": "EMR on EKS Engine" } } }, { "Sid": "AssumeJobRoleAccess", "Effect": "Allow", "Action": [ "sts:AssumeRole" ], "Resource": [ "arn:aws:iam::*:role/JobExecutionRole" ] }, { "Sid": "CreateCertificateAccessForTLS", "Effect": "Allow", "Action": [ "emr-containers:CreateCertificate" ], "Resource": [ "*" ] } ] }
Configure the trust policy of the system role to trust the Kubernetes system namespace.
aws emr-containers update-role-trust-policy \ --cluster-nameeks-cluster\ --namespaceeks-system-namespace\ --role-namesystem-role-name
For more information, see Update the role trust policy.
Step 3: Configure the job execution role trust policy
Configure the trust policy of each job execution role to let the system role assume it
and tag the session. The session tag value EMR on EKS Engine must match the
authorizedSessionTagValue in the security configuration and the value allowed
in AWS Lake Formation. Matching is exact, including case.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "TagSessionTrustForSystemDriver", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::123456789012:role/SystemRole" }, "Action": [ "sts:TagSession" ], "Condition": { "StringLike": { "aws:RequestTag/LakeFormationAuthorizedCaller": "EMR on EKS Engine" } } }, { "Sid": "AssumeRoleTrust", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::123456789012:role/SystemRole" }, "Action": "sts:AssumeRole" } ] }
Step 4: Create a security configuration with a system role
Create a security configuration that names the system role and the system namespace that the system role trusts.
aws emr-containers create-security-configuration \ --name 'security-configuration-name' \ --security-configuration-data '{ "authenticationConfiguration": { "iamConfiguration": { "systemRole": "system-role-ARN" } } }' \ --container-provider '{ "type": "EKS", "id": "eks-cluster-name", "info": { "eksInfo": { "namespace": "system-namespace-name" } } }'
An Amazon EMR managed component in the system namespace vends the credentials that carry
the propagated identity to the job pods. If you set both a system role and a query engine
role (queryEngineRoleArn), Amazon EMR on EKS uses the system role.
Creating a virtual cluster with a security configuration that includes a system
role is asynchronous. Your automation should wait for the virtual cluster to reach the
RUNNING state before it submits work. For more information, see Virtual cluster states.
Run your workloads
After setup is complete, create sessions and submit jobs as usual. A job runs on behalf
of the user who submits it. For instructions, see Submit a job run with
StartJobRun.
Background sessions and identity lifetime
Amazon EMR keeps a job attributable to the 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 on EKS 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 instance has background sessions enabled by default. A migrated instance keeps its previous setting. 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, it is 90 days with an attached IAM Identity Center instance, and 7 days without one.