授予 AWS CLI 权限

Grant AWS CLI permissions

我有一个用户组 Administrators 附加了以下策略:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "*",
            "Resource": "*"
        }
    ]
}

我当前登录的 CLI 用户属于该组;我已经通过 运行 aws iam get-user 进行了验证,并将 ARN 与我在 Web 控制台中的内容进行了比较。

不知何故有很多 CLI 命令我被拒绝了,例如

$ aws iam list-groups

An error occurred (AccessDenied) when calling the ListGroups operation: User: arn:aws:iam::675072143536:user/carl is not authorized to perform: iam:ListGroups on resource: arn:aws:iam::675072143536:group/ with an explicit deny

如何执行此命令?

您有一个 SCP 或权限边界 明确拒绝 该操作。参见 https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html

您可能能够在 IAM 控制台中检查边界或 SCP,或者需要询问对您的帐户具有更多权限/控制权的人,以了解更多详细信息,了解他们为何在那里以及如何获得绕过的权限他们。现在不允许您执行该命令。

我被我们的 MFA 政策拒绝了:

{
    "Sid": "DenyAllExceptListedIfNoMFA",
    "Effect": "Deny",
    "NotAction": [
        "iam:CreateVirtualMFADevice",
        "iam:EnableMFADevice",
        "iam:GetUser",
        "iam:ListMFADevices",
        "iam:ListVirtualMFADevices",
        "iam:ResyncMFADevice",
        "sts:GetSessionToken"
    ],
    "Resource": "*",
    "Condition": {
        "BoolIfExists": {
            "aws:MultiFactorAuthPresent": "false"
        }
    }
}