EMR Studio サービスロールを作成する - Amazon EMR

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

EMR Studio サービスロールを作成する

EMR Studio サービスロールについて

各 EMR Studio は、Studio が他の AWS サービスとやり取りできるようにするアクセス許可を持つ IAMロールを使用します。このサービスロールには、Workspace とクラスター間の安全なネットワークチャネルを確立EMRし、ノートブックファイルを に保存し Amazon S3 Control、Workspace を Git リポジトリにリンク AWS Secrets Manager しながら にアクセスできるようにするアクセス許可が含まれている必要があります。

(セッションポリシーの代わりに) Studio サービスロールを使用して、ノートブックファイルを保存するためのすべての Amazon S3 アクセス許可を定義し、 AWS Secrets Manager アクセス許可を定義します。

Amazon EC2または Amazon で EMR Studio のサービスロールを作成する方法 EKS

  1. 「ロールを作成して AWS サービスにアクセス許可を委任する」の手順に従って、次の信頼ポリシーでサービスロールを作成します。

    重要

    次の信頼ポリシーには、Studio に付与するアクセス許可をアカウント内の特定のリソースに制限するための EMR aws:SourceArnおよび aws:SourceAccount グローバル条件キーが含まれています。そうすることで、「混乱した代理」問題から保護できます。

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "elasticmapreduce.amazonaws.com" }, "Action": "sts:AssumeRole", "Condition": { "StringEquals": { "aws:SourceAccount": "<account-id>" }, "ArnLike": { "aws:SourceArn": "arn:aws:elasticmapreduce:<region>:<account-id>:*" } } } ] }
  2. デフォルトのロールアクセス許可を削除します。次に、次のサンプルアクセス許可ポリシーからのIAMアクセス許可を含めます。または、EMR Studio サービスロールのアクセス許可 を使用するカスタムポリシーを作成できます。

    重要
    • で Amazon EC2 タグベースのアクセスコントロールを EMR Studio と連携させるには、次のポリシーModifyNetworkInterfaceAttributeAPIに示すように、 のアクセスを設定する必要があります。

    • EMR Studio でサービスロールを使用するには、 AllowAddingEMRTagsDuringDefaultSecurityGroupCreationおよび のステートメントを変更しないでくださいAllowAddingTagsDuringEC2ENICreation

    • サンプルポリシーを使用するには、キー "for-use-with-amazon-emr-managed-policies" および値 "true" を使用して次のリソースにタグ付けする必要があります。

      • EMR Studio 用の Amazon Virtual Private Cloud (VPC)。

      • Studio で使用する各サブネット。

      • 任意のカスタム EMR Studio セキュリティグループ。引き続き使用する場合は、EMRStudio プレビュー期間中に作成したセキュリティグループにタグを付ける必要があります。

      • Studio ユーザーが Git リポジトリを Workspace にリンクするために使用する で維持 AWS Secrets Manager されているシークレット。

      AWS Management Consoleの関連するリソース画面の [Tag] (タグ) タブを使用してリソースにタグを適用できます。

    該当する場合は、次のポリシー*"Resource":"*"の の を変更して、ステートメントがユースケースでカバーするリソースの Amazon リソースネーム (ARN) を指定します。

    { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowEMRReadOnlyActions", "Effect": "Allow", "Action": [ "elasticmapreduce:ListInstances", "elasticmapreduce:DescribeCluster", "elasticmapreduce:ListSteps" ], "Resource": "*" }, { "Sid": "AllowEC2ENIActionsWithEMRTags", "Effect": "Allow", "Action": [ "ec2:CreateNetworkInterfacePermission", "ec2:DeleteNetworkInterface" ], "Resource": [ "arn:aws:ec2:*:*:network-interface/*" ], "Condition": { "StringEquals": { "aws:ResourceTag/for-use-with-amazon-emr-managed-policies": "true" } } }, { "Sid": "AllowEC2ENIAttributeAction", "Effect": "Allow", "Action": [ "ec2:ModifyNetworkInterfaceAttribute" ], "Resource": [ "arn:aws:ec2:*:*:instance/*", "arn:aws:ec2:*:*:network-interface/*", "arn:aws:ec2:*:*:security-group/*" ] }, { "Sid": "AllowEC2SecurityGroupActionsWithEMRTags", "Effect": "Allow", "Action": [ "ec2:AuthorizeSecurityGroupEgress", "ec2:AuthorizeSecurityGroupIngress", "ec2:RevokeSecurityGroupEgress", "ec2:RevokeSecurityGroupIngress", "ec2:DeleteNetworkInterfacePermission" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceTag/for-use-with-amazon-emr-managed-policies": "true" } } }, { "Sid": "AllowDefaultEC2SecurityGroupsCreationWithEMRTags", "Effect": "Allow", "Action": [ "ec2:CreateSecurityGroup" ], "Resource": [ "arn:aws:ec2:*:*:security-group/*" ], "Condition": { "StringEquals": { "aws:RequestTag/for-use-with-amazon-emr-managed-policies": "true" } } }, { "Sid": "AllowDefaultEC2SecurityGroupsCreationInVPCWithEMRTags", "Effect": "Allow", "Action": [ "ec2:CreateSecurityGroup" ], "Resource": [ "arn:aws:ec2:*:*:vpc/*" ], "Condition": { "StringEquals": { "aws:ResourceTag/for-use-with-amazon-emr-managed-policies": "true" } } }, { "Sid": "AllowAddingEMRTagsDuringDefaultSecurityGroupCreation", "Effect": "Allow", "Action": [ "ec2:CreateTags" ], "Resource": "arn:aws:ec2:*:*:security-group/*", "Condition": { "StringEquals": { "aws:RequestTag/for-use-with-amazon-emr-managed-policies": "true", "ec2:CreateAction": "CreateSecurityGroup" } } }, { "Sid": "AllowEC2ENICreationWithEMRTags", "Effect": "Allow", "Action": [ "ec2:CreateNetworkInterface" ], "Resource": [ "arn:aws:ec2:*:*:network-interface/*" ], "Condition": { "StringEquals": { "aws:RequestTag/for-use-with-amazon-emr-managed-policies": "true" } } }, { "Sid": "AllowEC2ENICreationInSubnetAndSecurityGroupWithEMRTags", "Effect": "Allow", "Action": [ "ec2:CreateNetworkInterface" ], "Resource": [ "arn:aws:ec2:*:*:subnet/*", "arn:aws:ec2:*:*:security-group/*" ], "Condition": { "StringEquals": { "aws:ResourceTag/for-use-with-amazon-emr-managed-policies": "true" } } }, { "Sid": "AllowAddingTagsDuringEC2ENICreation", "Effect": "Allow", "Action": [ "ec2:CreateTags" ], "Resource": "arn:aws:ec2:*:*:network-interface/*", "Condition": { "StringEquals": { "ec2:CreateAction": "CreateNetworkInterface" } } }, { "Sid": "AllowEC2ReadOnlyActions", "Effect": "Allow", "Action": [ "ec2:DescribeSecurityGroups", "ec2:DescribeNetworkInterfaces", "ec2:DescribeTags", "ec2:DescribeInstances", "ec2:DescribeSubnets", "ec2:DescribeVpcs" ], "Resource": "*" }, { "Sid": "AllowSecretsManagerReadOnlyActionsWithEMRTags", "Effect": "Allow", "Action": [ "secretsmanager:GetSecretValue" ], "Resource": "arn:aws:secretsmanager:*:*:secret:*", "Condition": { "StringEquals": { "aws:ResourceTag/for-use-with-amazon-emr-managed-policies": "true" } } }, { "Sid": "AllowWorkspaceCollaboration", "Effect": "Allow", "Action": [ "iam:GetUser", "iam:GetRole", "iam:ListUsers", "iam:ListRoles", "sso:GetManagedApplicationInstance", "sso-directory:SearchUsers" ], "Resource": "*" } ] }
  3. EMR Studio の Amazon S3 ロケーションへの読み取りおよび書き込みアクセスをサービスロールに許可します。次の最小アクセス許可セットを使用します。詳細は、「Amazon S3: S3 バケットのオブジェクトへの読み取りおよび書き込みアクセスをプログラムによりコンソールで許可する」の例を参照してください。

    "s3:PutObject", "s3:GetObject", "s3:GetEncryptionConfiguration", "s3:ListBucket", "s3:DeleteObject"

    Amazon S3 バケットを暗号化する場合は、 AWS Key Management Serviceの以下のアクセス許可を含めます。

    "kms:Decrypt", "kms:GenerateDataKey", "kms:ReEncryptFrom", "kms:ReEncryptTo", "kms:DescribeKey"
  4. ユーザーレベルで Git シークレットへのアクセスを制御する場合は、EMRStudio ユーザーロールポリシー secretsmanager:GetSecretValueの にタグベースのアクセス許可を追加し、EMRStudio サービスロールsecretsmanager:GetSecretValueポリシー からポリシー へのアクセス許可を削除します。 きめ細かいユーザーのアクセス許可の設定方法の詳細については、「EMR Studio ユーザーのアクセス許可ポリシーを作成する」を参照してください。

EMR Serverless の最小サービスロール

EMR Studio ノートブックを介して EMR Serverless でインタラクティブワークロードを実行する場合は、前のセクション で EMR Studio のセットアップに使用したものと同じ信頼ポリシーを使用しますAmazon EC2または Amazon で EMR Studio のサービスロールを作成する方法 EKS

IAM ポリシーの場合、実行可能な最小ポリシーには、次のようにアクセス許可があります。EMR Studio と Workspace を設定するときに使用する予定のバケットの名前bucket-nameで を更新します。EMR Studio は、Studio の Workspace とノートブックファイルをバックアップするバケットを使用します。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "ObjectActions", "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject" ], "Resource": ["arn:aws:s3:::bucket-name/*"] }, { "Sid": "BucketActions", "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetEncryptionConfiguration" ], "Resource": ["arn:aws:s3:::bucket-name"] } ] }

暗号化された Amazon S3 バケットを使用する場合は、ポリシーに以下のアクセス許可を追加します。

"kms:Decrypt", "kms:GenerateDataKey", "kms:ReEncryptFrom", "kms:ReEncryptTo", "kms:DescribeKey"

EMR Studio サービスロールのアクセス許可

次の表に、サービスロールを使用して EMR Studio が実行するオペレーションと、各オペレーションに必要なIAMアクションを示します。

操作 アクション
Workspace と EMRクラスターの間に安全なネットワークチャネルを確立し、必要なクリーンアップアクションを実行します。
"ec2:CreateNetworkInterface", "ec2:CreateNetworkInterfacePermission", "ec2:DeleteNetworkInterface", "ec2:DeleteNetworkInterfacePermission", "ec2:DescribeNetworkInterfaces", "ec2:ModifyNetworkInterfaceAttribute", "ec2:AuthorizeSecurityGroupEgress", "ec2:AuthorizeSecurityGroupIngress", "ec2:CreateSecurityGroup", "ec2:DescribeSecurityGroups", "ec2:RevokeSecurityGroupEgress", "ec2:DescribeTags", "ec2:DescribeInstances", "ec2:DescribeSubnets", "ec2:DescribeVpcs", "elasticmapreduce:ListInstances", "elasticmapreduce:DescribeCluster", "elasticmapreduce:ListSteps"
に保存されている Git 認証情報 AWS Secrets Manager を使用して、Git リポジトリを Workspace にリンクします。
"secretsmanager:GetSecretValue"
セキュアネットワークチャネルの設定中に EMR Studio が作成するネットワークインターフェイスとデフォルトのセキュリティグループに AWS タグを適用します。詳細については、「AWS リソースのタグ付け」を参照してください。
"ec2:CreateTags"
ノートブックファイルとメタデータにアクセスする、それらを Amazon S3 にアップロードする。
"s3:PutObject", "s3:GetObject", "s3:GetEncryptionConfiguration", "s3:ListBucket", "s3:DeleteObject"

暗号化された Amazon S3 バケットを使用する場合は、以下のアクセス許可を含めます。

"kms:Decrypt", "kms:GenerateDataKey", "kms:ReEncryptFrom", "kms:ReEncryptTo", "kms:DescribeKey"
Workspace コラボレーションを有効にして設定します。
"iam:GetUser", "iam:GetRole", "iam:ListUsers", "iam:ListRoles", "sso:GetManagedApplicationInstance", "sso-directory:SearchUsers"
でカスタマーマネージドキー (CMK) を使用して EMR Studio ワークスペースのノートブックとファイルを暗号化する AWS Key Management Service
"kms:Decrypt", "kms:GenerateDataKey", "kms:ReEncryptFrom", "kms:ReEncryptTo", "kms:DescribeKey"