EMR Notebooks 的服務角色 - Amazon EMR

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

EMR Notebooks 的服務角色

每個 EMR 筆記本都需要存取其他 AWS 資源和執行動作的權限。附加到此服務角色的 IAM 政策為筆記本提供了與其他 AWS 服務互操作的許可。使用建立筆記本時 AWS Management Console,您可以指定AWS 服務角色。您可以使用預設的角色 EMR_Notebooks_DefaultRole 或指定您建立的角色。如果先前未建立筆記本,您可以選擇建立預設的角色。

  • 預設角色名稱為 EMR_Notebooks_DefaultRole

  • 附接至 EMR_Notebooks_DefaultRole 的預設受管政策是 AmazonElasticMapReduceEditorsRoleS3FullAccessPolicy

您的服務角色應使用下列信任政策。

重要

下列信任政策包括 aws:SourceArnaws:SourceAccount 全域條件金鑰,這些金鑰會將您授予 Amazon EMR 的許可限制在帳戶中的特定資源。使用它們可以保護您免受混淆代理人問題

{ "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>:*" } } } ] }

AmazonElasticMapReduceEditorsRole 第 1 版的內容如下。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:AuthorizeSecurityGroupEgress", "ec2:AuthorizeSecurityGroupIngress", "ec2:CreateSecurityGroup", "ec2:DescribeSecurityGroups", "ec2:RevokeSecurityGroupEgress", "ec2:CreateNetworkInterface", "ec2:CreateNetworkInterfacePermission", "ec2:DeleteNetworkInterface", "ec2:DeleteNetworkInterfacePermission", "ec2:DescribeNetworkInterfaces", "ec2:ModifyNetworkInterfaceAttribute", "ec2:DescribeTags", "ec2:DescribeInstances", "ec2:DescribeSubnets", "ec2:DescribeVpcs", "elasticmapreduce:ListInstances", "elasticmapreduce:DescribeCluster", "elasticmapreduce:ListSteps" ], "Resource": "*" }, { "Effect": "Allow", "Action": "ec2:CreateTags", "Resource": "arn:aws:ec2:*:*:network-interface/*", "Condition": { "ForAllValues:StringEquals": { "aws:TagKeys": [ "aws:elasticmapreduce:editor-id", "aws:elasticmapreduce:job-flow-id" ] } } } ] }

以下是 S3FullAccessPolicy 的內容。S3FullAccessPolicy 可讓 EMR Notebooks 的服務角色對您 AWS 帳戶中的物件執行所有 Amazon S3 動作。為 EMR Notebooks 建立自訂服務角色時,您必須授予服務角色 Amazon S3 許可。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "s3:*", "Resource": "*" } ] }

您可以將服務角色的讀取和寫入存取權範圍縮減至要儲存筆記本檔案的 Amazon S3 位置。請使用下列最小 Amazon 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"

當您將 Git 儲存庫連結到筆記本並需要為儲存庫建立機密時,您必須在附接至 Amazon EMR Notebooks 服務角色的 IAM 政策中新增 secretsmanager:GetSecretValue 許可。範例政策如下所示:

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": "secretsmanager:GetSecretValue", "Resource": "*" } ] }

EMR Notebooks 服務角色許可

下表列出 EMR Notebooks 使用服務角色所採取的動作,以及每個動作所需的許可。

動作 許可
在筆記本與 Amazon 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"
使用儲存在 AWS Secrets Manager 中的 Git 憑證,以將 Git 儲存庫連結至筆記本。
"secretsmanager:GetSecretValue"
將 AWS 標記套用至 EMR Notebooks 在設定安全網路通道時所建立的網路介面和預設安全性群組。如需詳細資訊,請參閱標記 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"

EMR Notebooks 更新 AWS 受管理原則

檢視自 2021 年 3 月 1 日起 EMR Notebooks AWS 受管政策更新的詳細資料。

變更 描述 日期
AmazonElasticMapReduceEditorsRole - Added permissions

EMR Notebooks 已將 ec2:describeVPCselastmicmapreduce:ListSteps 許可新增至 AmazonElasticMapReduceEditorsRole

2023 年 2 月 8 日

EMR Notebooks 已開始追蹤變更

EMR Notebooks 開始追蹤其 AWS 受管理原則的變更。

2023 年 2 月 8 日