-

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Prasyarat

  1. Lihat perinciannya di .

JSON
{ "Version":"2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": "elasticmapreduce:GetClusterSessionCredentials", "Resource": "*", "Condition": { "ArnLike": { "elasticmapreduce:ExecutionRoleArn": [ "arn:aws:iam::111122223333:role/emr-execution-role-ml-modeling*", "arn:aws:iam::111122223333:role/emr-execution-role-ml-training*" ]}, "StringLike":{ "elasticmapreduce:ResourceTag/group": [ "*modeling*", "*training*" ] } } } ] }

  1. JSON
    { "Version":"2012-10-17", "Statement": [ { "Sid": "AllowAssumeCrossAccountEMRAccessRole", "Effect": "Allow", "Action": "sts:AssumeRole", "Resource": "arn:aws:iam::111122223333:role/emr-access-role-name" } ] }
  2. JSON
    { "Version":"2012-10-17", "Statement": [ { "Sid": "AllowCrossAccountSageMakerExecutionRoleToAssumeThisRole", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::111122223333:role/studio_execution_role" }, "Action": "sts:AssumeRole" } ] }
  3. JSON
    { "Version":"2012-10-17", "Statement": [ { "Sid": "AllowCallingEmrGetClusterSessionCredentialsAPI", "Effect": "Allow", "Action": "elasticmapreduce:GetClusterSessionCredentials", "Resource": "arn:aws:elasticmapreduce:us-east-1:111122223333:cluster/cluster-id", "Condition": { "StringLike": { "elasticmapreduce:ExecutionRoleArn": [ "arn:aws:iam::111122223333:role/emr-execution-role-name" ] } } } ] }

Preload runtime roles in JupyterLab using the SageMaker AI console

  1. Pilih Kirim.

Preload runtime roles in JupyterLab using a Python script

import botocore.session import json sess = botocore.session.get_session() client = sess.create_client('sagemaker') client.update_user_profile( DomainId="domainID", UserProfileName="user-profile-name", UserSettings={ 'JupyterLabAppSettings': { 'EmrSettings': { 'AssumableRoleArns': ["arn:aws:iam::emr-accountID:role/AssumableRole"], 'ExecutionRoleArns': ["arn:aws:iam::emr-accountID:role/EMRServiceRole", "arn:aws:iam::emr-accountID:role/AnotherServiceRole"] } } }) resp = client.describe_user_profile(DomainId="domainID", UserProfileName=user-profile-name") resp['CreationTime'] = str(resp['CreationTime']) resp['LastModifiedTime'] = str(resp['LastModifiedTime']) print(json.dumps(resp, indent=2))
Preload runtime roles in Studio Classic

#!/bin/bash set -eux FILE_DIRECTORY="/home/sagemaker-user/.sagemaker-analytics-configuration-DO_NOT_DELETE" FILE_NAME="emr-configurations-DO_NOT_DELETE.json" FILE="$FILE_DIRECTORY/$FILE_NAME" mkdir -p $FILE_DIRECTORY cat << 'EOF' > "$FILE" { "emr-execution-role-arns": { "123456789012": [ "arn:aws:iam::123456789012:role/emr-execution-role-1", "arn:aws:iam::123456789012:role/emr-execution-role-2" ] } } EOF

#!/bin/bash set -eux FILE_DIRECTORY="/home/sagemaker-user/.sagemaker-analytics-configuration-DO_NOT_DELETE" FILE_NAME="emr-configurations-DO_NOT_DELETE.json" FILE="$FILE_DIRECTORY/$FILE_NAME" mkdir -p $FILE_DIRECTORY cat << 'EOF' > "$FILE" { "emr-execution-role-arns": { "123456789012": [ "arn:aws:iam::212121212121:role/emr-execution-role-1", "arn:aws:iam::434343434343:role/emr-execution-role-2" ] } } EOF # add your cross-account EMR access role FILE_DIRECTORY="/home/sagemaker-user/.cross-account-configuration-DO_NOT_DELETE" FILE_NAME="emr-discovery-iam-role-arns-DO_NOT_DELETE.json" FILE="$FILE_DIRECTORY/$FILE_NAME" mkdir -p $FILE_DIRECTORY cat << 'EOF' > "$FILE" { "123456789012": "arn:aws:iam::123456789012:role/cross-account-emr-access-role" } EOF