如何自定义 IAM 策略?

0

【以下的问题经过翻译处理】 您好!

假设我们为IAM用户设置了以下策略:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "iam:GetUser",
                "iam:CreateUser",
                "iam:CreateAccessKey"
            ],
            "Resource": "arn:aws:iam::*:user/iot.*"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": "iam:AddUserToGroup",
            "Resource": "arn:aws:iam::*:group/CUSTOMGROUP"
        }
    ]
}

现在他应该能够为所有以“iot.”开头的IAM用户执行GetUser、CreateUser和CreateAccessKey。第二个规则应该允许他将IAM用户添加到组“CUSTOMGROUP”。 现在我希望用户只能将其他以“iot.”开头的IAM用户添加到组“CUSTOMGROUP”.怎么做呢?是否可以添加类似以下的内容:

"Condition": {"StringLike": {"iam:user": ["iot.*"]}}

但没有用...有什么可以实现的方式么?

1 Resposta
0

【以下的回答经过翻译处理】 你好,动作“AddUserToGroup”不支持任何条件键。因此,无法限制此动作在指定用户名上执行。

profile picture
ESPECIALISTA
respondido há 5 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas