Administrators can configure permissions for the SageMaker Studio execution role to grant users the ability to view the list of Amazon EMR clusters they have access to, allowing them to connect to these clusters. The clusters to which you want access can be deployed in the same AWS account as Studio (choose Single account) or in separate accounts (choose Cross account). The following page describes how to grant the permissions for viewing Amazon EMR clusters from Studio or Studio Classic.
Important
You can only discover and connect to Amazon EMR clusters for JupyterLab and Studio Classic applications that are launched from private spaces. Ensure that the Amazon EMR clusters are located in the same AWS region as your Studio environment.
To let data scientists discover and then connect to Amazon EMRclusters from Studio or Studio Classic, follow these steps.
If your Amazon EMR clusters and Studio or Studio Classic are deployed in the same AWS account, attach the following permissions to the SageMaker AI execution role accessing your cluster.
-
Step 1: Retrieve the ARN of the SageMaker AI execution role used by your private space.
For information on spaces and execution roles in SageMaker AI, see Understanding domain space permissions and execution roles.
For more information about how to retrieve the ARN of SageMaker AI's execution role, see Get your execution role.
-
Step 2: Attach the following permissions to the SageMaker AI execution role accessing your Amazon EMR clusters.
-
Navigate to the IAM console
. -
Choose Roles and then search for your execution role by name in the Search field. The role name is the last part of the ARN, after the last forward slash (/).
-
Follow the link to your role.
-
Choose Add permissions and then Create inline policy.
-
In the JSON tab, add the Amazon EMR permissions allowing Amazon EMR access and operations. For details on the policy document, see List Amazon EMR policies in Reference policies. Replace the
region
, andaccountID
with their actual values before copying the list of statements to the inline policy of your role. -
Choose Next and then provide a Policy name.
-
Choose Create policy.
-
Note
Users of role-based access control (RBAC) connectivity to Amazon EMR clusters should also refer to Configure runtime role authentication when your Amazon EMR cluster and Studio are in the same account.
Before you get started, retrieve the ARN of the SageMaker AI execution role used by your private space.
For information on spaces and execution roles in SageMaker AI, see Understanding domain space permissions and execution roles.
For more information about how to retrieve the ARN of SageMaker AI's execution role, see Get your execution role.
If your Amazon EMR clusters and Studio or Studio Classic are deployed in separate AWS accounts, you configure the permissions on both accounts.
Note
Users of role-based access control (RBAC) connectivity to Amazon EMR clusters should also refer to Configure runtime role authentication when your cluster and Studio are in different accounts.
On the Amazon EMR cluster account
Follow these steps to create the necessary roles and policies on the account where Amazon EMR is deployed, also referred to as the trusting account:
-
Step 1: Retrieve the ARN of the service role of your Amazon EMR cluster.
To learn about how to find the ARN of the service role of a cluster, see Configure IAM service roles for Amazon EMR permissions to AWS services and resources.
-
Step 2: Create a custom IAM role named
AssumableRole
with the following configuration:-
Permissions: Grant the necessary permissions to
AssumableRole
to allow accessing Amazon EMR resources. This role is also known as an Access role in scenarios involving cross-account access. -
Trust relationship: Configure the trust policy for
AssumableRole
to allow assuming the execution role (TheSageMakerExecutionRole
in the cross-account diagram) from the Studio account that requires access.
By assuming the role, Studio or Studio Classic can gain temporary access to the permissions it needs in Amazon EMR.
For detailed instructions on how to create a new
AssumableRole
in your Amazon EMR AWS account, follow these steps:-
Navigate to the IAM console
. -
In the left navigation pane, choose Policy, and then Create policy.
-
In the JSON tab, add the Amazon EMR permissions allowing Amazon EMR access and operations. For details on the policy document, see List Amazon EMR policies in Reference policies. Replace the
region
, andaccountID
with their actual values before copying the list of statements to the inline policy of your role. -
Choose Next and then provide a Policy name.
-
Choose Create policy.
-
In the left navigation pane, choose Roles and then Create role.
-
On the Create role page, choose Custom trust policy as the trusted entity.
-
Paste in the following JSON document in the Custom trust policy section and then choose Next.
-
In the Add permissions page, add the permission you just created and then choose Next.
-
On the Review page, enter a name for the role such as
AssumableRole
and an optional description. -
Review the role details and choose Create role.
For more information about creating a role on an AWS account, see Creating an IAM role (console).
-
On the Studio account
On the account where Studio is deployed, also referred to as the trusted account, update the SageMaker AI execution role accessing your clusters with the required permissions to access resources in the trusting account.
-
Step 1: Retrieve the ARN of the SageMaker AI execution role used by your private space.
For information on spaces and execution roles in SageMaker AI, see Understanding domain space permissions and execution roles.
For more information about how to retrieve the ARN of SageMaker AI's execution role, see Get your execution role.
-
Step 2: Attach the following permissions to the SageMaker AI execution role accessing your Amazon EMR clusters.
-
Navigate to the IAM console
. -
Choose Roles and then search for your execution role by name in the Search field. The role name is the last part of the ARN, after the last forward slash (/).
-
Follow the link to your role.
-
Choose Add permissions and then Create inline policy.
-
In the JSON tab, add the inline policy granting the role permissions to update the domains, user profiles, and spaces. For details on the policy document, see Domain, user profile, and space update actions policy in Reference policies. Replace the
region
andaccountID
with their actual values before copying the list of statements to the inline policy of your role. -
Choose Next and then provide a Policy name.
-
Choose Create policy.
-
Repeat the Create inline policy step to add another policy granting the execution role the permissions to assume the
AssumableRole
and then perform actions permitted by the role's access policy. Replaceemr-account
with the Amazon EMR account ID, andAssumableRole
with the name of the assumable role created in the Amazon EMR account.{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowRoleAssumptionForCrossAccountDiscovery", "Effect": "Allow", "Action": "sts:AssumeRole", "Resource": ["arn:aws:iam::
emr-account
:role/AssumableRole
" ] }] } -
(Optional) To allow listing Amazon EMR clusters deployed in the same account as Studio, add an additional inline policy to your Studio execution role as defined in List Amazon EMR policies in Reference policies.
-
-
Step 3: Associate your assumable role(s) (access role) with your domain or user profile. JupyterLab users in Studio can use the SageMaker AI console or the provided script.
Choose the tab that corresponds to your use case.
Refer to List Amazon EMR clusters from Studio or Studio Classic to learn about how to discover and connect to Amazon EMR clusters from Studio or Studio Classic notebooks.