EMR 的 AWS IAM 策略资源声明

AWS IAM Policy Resource declaration for EMR

我正在阅读有关为 EMR 创建 IAM 策略的内容,但对 JSON 声明中 Resource: 部分的使用有些困惑。

https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-fine-grained-cluster-access.html

例如,在下面的示例中,使用 * 将暗示 AWS 帐户中的所有资源,但由于特定权限是 elasticmapreduce:CreateEditor,这是否真的只是暗示它最终只会影响假设满足条件块,EMR 中的编辑器资源?

下面link有一个资源类型定义,供编辑器使用arn:${Partition}:elasticmapreduce:${Region}:${Account}:editor/${EditorId}

resource:* 基本上等于 arn:${Partition}:elasticmapreduce:${Region}:${Account}:editor/* 吗?

https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonelasticmapreduce.html#amazonelasticmapreduce-studio

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "elasticmapreduce:CreateEditor"
            ],
            "Effect": "Allow",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "elasticmapreduce:RequestTag/creatorUserId": "${aws:userid}"
                }
            }
        }
    ]
}

另一个令人困惑的地方是,在下面的这个例子中声明了一个特定的资源类型。为什么这里不使用 Resource:*?我在第二个 link 中看到 StartEditor 权限具有必需的资源类型 clustereditor 但不会 Resource:*elasticmapreduce:StartEditor 足够具体以模仿 elasticmapreduce:CreateEditor 如何使用 Resource:*?

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "elasticmapreduce:StartEditor"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:elasticmapreduce:*:123456789012:editor/*",
            "Condition": {
                "StringEquals": {
                    "elasticmapreduce:ResourceTag/owner": [
                        "owner1",
                        "owner2"
                    ]
                }
            }
        }
    ]
}

这里有一些事情,我会按顺序回复你的问题:

since the specific permission is elasticmapreduce:CreateEditor does that really just imply that it ends up only affecting the editor resource in EMR assuming the conditional block is satisfied?

CreateEditor 操作仅适用于资源类型 cluster*,因此您基本上可以限制 IAM 实体可以为哪些集群创建编辑器。将 CreateEditor 限制为特定编辑器是没有意义的,因为该编辑器尚不存在。这也意味着 resource:* 在这种情况下不等于 rn:${Partition}:elasticmapreduce:${Region}:${Account}:editor/* 因为它只适用于集群。

Another area of confusion is that in this example below there is a specific resource type declared. Why isn't Resource:* used here?

在您的第二个示例中,目标明确地只允许访问具有特定“所有者”标签的编辑。在该政策中加入 Resource:* 也会将标签要求扩展到集群(因为 elasticmapreduce:StartEditor 可以同时适用于集群和编辑器)。这意味着 编辑器和集群 都需要 IAM 实体的标签才能启动编辑器。

正如您在 link 中第二个代码后面的两个示例中看到的那样(第 限制基于标签启动笔记本的能力 ),然后扩展示例以指定集群的不同标记要求。