本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
建立 EMR Studio 服務角色
關於 EMR Studio 服務角色
每個 EMR Studio 都使用具有許可IAM的角色,讓 Studio 與其他 AWS 服務互動。此服務角色必須包含允許 EMR Studio 在工作區和叢集之間建立安全網路頻道、在 中存放筆記本檔案 Amazon S3 Control,以及在將工作區連結至 Git 儲存庫 AWS Secrets Manager 時存取 的許可。
使用 Studio 服務角色 (而非工作階段政策) 定義用於存放筆記本檔案的所有 Amazon S3 存取許可,並定義 AWS Secrets Manager 存取許可。
如何在 Amazon EC2或 Amazon 上為 EMR Studio 建立服務角色 EKS
請遵循建立角色中的指示,將許可委派給 AWS 服務,以使用下列信任政策建立服務角色。
重要
下列信任政策包含
aws:SourceArn
和aws:SourceAccount
全域條件索引鍵,以限制您將 EMR Studio 授予帳戶中特定資源的許可。這樣可保護您避免混淆代理人問題。{ "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>
:*" } } } ] }請移除預設角色許可。然後,包含下列範例許可政策的IAM許可。或者,可以建立使用 EMR Studio 服務角色許可 的自訂政策。
重要
-
若要使用 搭配 EMR Studio 使用 的 Amazon EC2標籤型存取控制,您必須設定 的存取權
ModifyNetworkInterfaceAttribute
API,如下列政策所示。 -
若要讓 EMR Studio 使用服務角色,您不得變更下列陳述式:
AllowAddingEMRTagsDuringDefaultSecurityGroupCreation
和AllowAddingTagsDuringEC2ENICreation
。 -
若要使用範例政策,必須使用索引鍵
"for-use-with-amazon-emr-managed-policies"
和值"true"
來標記下列資源。-
適用於 EMR Studio 的 Amazon Virtual Private Cloud (VPC)。
-
要搭配 Studio 使用的每個子網路。
-
任何自訂 EMR Studio 安全群組。如果您想要繼續使用,則必須標記您在 EMR Studio 預覽期間建立的任何安全群組。
-
在該 Studio 使用者中維護 AWS Secrets Manager 的秘密用於將 Git 儲存庫連結至工作區。
可以使用 AWS Management Console中相關資源畫面上的標籤將標籤套用至資源。
-
如適用,請在下列政策
"Resource":"
中變更*
"
中的 ,以指定陳述式涵蓋的使用案例資源的 Amazon Resource Name (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": "*" } ] }
-
授予服務角色讀取和寫入 Studio Amazon S3 位置的存取權EMR。請使用下列最小許可集。如需詳細資訊,請參閱 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"
-
如果您想要在使用者層級控制對 Git 秘密的存取,請在 EMR Studio 使用者角色政策
secretsmanager:GetSecretValue
中將標籤型許可新增至 ,並從 EMR Studio 服務角色政策 中移除secretsmanager:GetSecretValue
政策的許可。 如需有關設定精細使用者許可的詳細資訊,請參閱 為 EMR Studio 使用者建立許可政策。
EMR Serverless 的最低服務角色
如果您想要透過 EMR Studio 筆記本使用 EMR Serverless 執行互動式工作負載,請使用您在上一節 中用來設定 EMR Studio 的相同信任政策如何在 Amazon EC2或 Amazon 上為 EMR Studio 建立服務角色 EKS。
針對您的IAM政策,最低可行政策具有下列許可。
使用設定 EMR Studio 和工作區時計劃使用的儲存貯體名稱進行更新。EMR Studio 使用儲存貯體備份 Studio 中的工作區和筆記本檔案。bucket-name
{ "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動作。
作業 | 動作 |
---|---|
在工作區和EMR叢集之間建立安全的網路通道,並執行必要的清除動作。 |
|
使用 中存放的 Git 憑證 AWS Secrets Manager ,將 Git 儲存庫連結至工作區。 |
|
將 AWS 標籤套用至 EMR Studio 在設定安全網路頻道時建立的網路介面和預設安全群組。如需詳細資訊,請參閱標記 AWS 資源。 |
|
存取筆記本檔案和中繼資料或上傳到 Amazon S3。 |
如果使用已加密的 Amazon S3 儲存貯體,請包含下列許可。
|
啟用並設定工作區協同合作。 |
|
使用客戶受管金鑰 (CMK) 搭配 加密 EMR Studio 工作區筆記本和檔案 AWS Key Management Service |
|