AWS RunInstance资源被拒绝,明确允许所有资源

时间:2020-08-21 04:21:53

标签: amazon-web-services amazon-ec2 amazon-iam

当我使用Iam可视编辑器创建角色来运行实例时,我遇到了一个痛苦的错误,如果我创建了两个策略,则第一个策略是隐式允许所有资源:

{
"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "VisualEditor0",
        "Effect": "Allow",
        "Action": "ec2:RunInstances",
        "Resource": "*"
    },
    {
        "Sid": "VisualEditor1",
        "Effect": "Allow",
        "Action": "iam:PassRole",
        "Resource": "arn:aws:iam::*:role/*"
    }
]

}

但是,如果我指定了明确允许所有资源的资源,则会得到以下政策:

{
"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "VisualEditor0",
        "Effect": "Allow",
        "Action": [
            "iam:PassRole",
            "ec2:RunInstances"
        ],
        "Resource": [
            "arn:aws:ec2:*:*:subnet/*",
            "arn:aws:ec2:*::snapshot/*",
            "arn:aws:ec2:*:*:launch-template/*",
            "arn:aws:ec2:*:*:security-group/*",
            "arn:aws:ec2:*:*:placement-group/*",
            "arn:aws:ec2:*:*:network-interface/*",
            "arn:aws:ec2:*:*:capacity-reservation/*",
            "arn:aws:ec2:*:*:key-pair/*",
            "arn:aws:ec2:*:*:instance/*",
            "arn:aws:elastic-inference:*:*:elastic-inference-accelerator/*",
            "arn:aws:ec2:*:*:elastic-gpu/*",
            "arn:aws:ec2:*:*:volume/*",
            "arn:aws:ec2:*::image/*",
            "arn:aws:iam::*:role/*"
        ]
    }
]

}

当我在EC2-Classic-InstanceStore中模拟runInstance时,IAM策略模拟器中的第一个策略通过,但是第二个策略没有通过。是否有aws尚未在其IAM可视编辑器中列出的资源?见附件图片: enter image description here

enter image description here

0 个答案:

没有答案