从管理AWS账户中排除权限?

时间:2016-12-02 12:35:14

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

我想创建一个拥有AdministratorAccess并管理所有内容的用户,例如拒绝在IAM中删除和更新操作

我试图这样做

  • 创建管理员用户
  • 创建拒绝在IAM中删除和更新操作的策略
  • 将该政策附加给用户
  • 用户现已拥有(AdministratorAccess + MyPolicy)

但是

  • 用户仍然可以删除和更新IAM中的用户
  • 我认为这是因为AdministratorAccess

有没有办法做到这一点,而不试图创建复杂的多个策略?

更新

这是我创建的政策

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "StmtXXXX",
            "Effect": "Deny",
            "Action": [
                "iam:ChangePassword",
                "iam:DeactivateMFADevice",
                "iam:DeleteAccessKey",
                "iam:DeleteAccountAlias",
                "iam:DeleteAccountPasswordPolicy",
                "iam:DeleteGroup",
                "iam:DeleteGroupPolicy",
                "iam:DeleteInstanceProfile",
                "iam:DeleteLoginProfile",
                "iam:DeleteOpenIDConnectProvider",
                "iam:DeletePolicy",
                "iam:DeletePolicyVersion",
                "iam:DeleteRole",
                "iam:DeleteRolePolicy",
                "iam:DeleteSAMLProvider",
                "iam:DeleteSSHPublicKey",
                "iam:DeleteServerCertificate",
                "iam:DeleteSigningCertificate",
                "iam:DeleteUser",
                "iam:DeleteUserPolicy",
                "iam:DeleteVirtualMFADevice",
                "iam:RemoveClientIDFromOpenIDConnectProvider",
                "iam:RemoveRoleFromInstanceProfile",
                "iam:RemoveUserFromGroup",
                "iam:UpdateAccessKey",
                "iam:UpdateLoginProfile",
                "iam:UpdateSSHPublicKey"
            ],
            "Resource": [
                "arn:aws:iam::1234:user/dummyadmin"
            ]
        }
    ]
}

更新2

将资源设置为arn:aws:iam::1234后,它就有效了!

2 个答案:

答案 0 :(得分:2)

可能更容易的选择是为除IAM之外的所有内容分配权限。这可以通过以下政策实现:

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

请注意使用NotAction排除IAM。

它与您的政策(可以使用CreateUser)不完全相同,但却是一种非常有效的方式来授予某人高级用户权限,而无法使用IAM。

答案 1 :(得分:0)

Chance资源

arn:aws:iam::1234