根据资源标签IAM限制对EC2的访问[重复]

问题描述 投票:0回答:1

这个问题在这里已有答案:

如果实例的标签为“protected = true”,我试图限制对组的EC2实例的访问

我用this AWS documentation作为向导,但我无法到达那里。

以下是相关政策:

{
        "Sid": "Stmt23578h8eh48r483h8r",
        "Effect": "Allow",
        "Action": [
            "ec2:*"
        ],
        "Resource": [
            "*"
        ]
    },
    {
        "Sid": "Stmt1513797341000",
        "Effect": "Deny",
        "Action": [
            "ec2:*"
        ],
        "Condition": {
            "StringEquals": {
                "ec2:ResourceTag/protected": "true"
            }
        },
        "Resource": [
            "*"
        ]
    },
    {
        "Sid": "58484htjg8rjf89438u8",
        "Effect": "Deny",
        "Action": [
            "ec2:CreateTags",
            "ec2:DeleteTags"
        ],
        "Resource": "*"
    }

对于这个应该允许一切(这是好的),然后如果ResourceTag匹配发生则拒绝一切。根据文档,我需要限制标记以保持用户接管资源。

然而,这不起作用。该组能够看到该实例。

amazon-web-services amazon-ec2 amazon-iam
1个回答
0
投票

根据标签限制视图访问是不可能的,请参考我的答案here

© www.soinside.com 2019 - 2024. All rights reserved.