简体   繁体   English

AWS 管理员角色政策

[英]AWS Admin Role Policy

I created a User in AWS Account and attached my user Admin access And I created another user with the same Admin access, But i don't want that user to delete my user.我在 AWS 帐户中创建了一个用户并附加了我的用户管理员访问权限我创建了另一个具有相同管理员访问权限的用户,但我不希望该用户删除我的用户。 Any Solutions任何解决方案

I want to know how to do it我想知道怎么做

With IAM policies an explicit deny takes precedence over an allow statement.对于 IAM 策略,显式拒绝优先于允许语句。 This means you can add a single deny statement for a specific resource but still access other resources.这意味着您可以为特定资源添加单个拒绝语句,但仍然可以访问其他资源。 You should be able to use this mechanic with IAM User permissions ( but you should create a test user to validate this works as expected!!! )您应该能够在具有 IAM 用户权限的情况下使用此机制(但您应该创建一个测试用户来验证它是否按预期工作!!!

Create a new policy with below contents and add to the user you want to limit access to delete your user创建一个包含以下内容的新策略并添加到您要限制访问的用户以删除您的用户

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Deny",
            "Action": ["iam:DeleteUser"],
            "Resource": "arn:aws:iam::000000000000:user/blah"
        }
    ]
}

(change 000000000000 to your aws account number and blah to the user you wish to prevent being deleted). (将000000000000更改为您的 aws 帐号,并将blah更改为您希望防止被删除的用户)。

Depending on your needs there are a bunch of other IAM permissions you might want to deny against this user such as RemoveUserFromGroup (if you use groups).根据您的需要,您可能想要拒绝针对此用户的许多其他 IAM 权限,例如RemoveUserFromGroup (如果您使用组)。 (The easiest way of seeing these is in the IAM Console - create a policy and use the Visual Editor. Select IAM as service, and look at the permissions available under the Write access section). (查看这些内容的最简单方法是在 IAM 控制台中 - 创建策略并使用可视化编辑器。Select IAM作为服务,并查看Write访问部分下可用的权限)。

NOTE: if your using the Create Policy Visual Editor you can switch between the JSON view and graphical view to see the actual policy.注意:如果您使用创建策略可视化编辑器,您可以在 JSON 视图和图形视图之间切换以查看实际策略。 If you edit the JSON view the Visual Editor view will be updated and vice-versa.如果您编辑 JSON 视图,Visual Editor 视图将更新,反之亦然。 There should be no errors or warnings reported by the Visual Editor when you complete your policy完成策略后,可视化编辑器不应报告任何错误或警告

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS 时间流上的策略允许角色执行的操作的 AccessDeniedException - AccessDeniedException for the action that is allowed to a role by a policy on AWS timestream aws cli 无法返回角色策略 - aws cli fails to return a role policy aws_iam_role 和aws_iam_role_policy 是什么意思? - What is the meaning of aws_iam_role and aws_iam_role_policy? 用户、组、角色、策略和 AWS 服务之间的关系是什么? - What is the relation between user, group, role, policy and AWS services? Terraform AWS IAM 角色“inline_policy.0.policy”包含使用 ${file xyz} 和 jsonencode 的无效 JSON 策略 - Terraform AWS IAM Role “inline_policy.0.policy” contains an invalid JSON policy using ${file xyz} and jsonencode terraform managed_policy_arns 问题与 aws_iam_role - terraform managed_policy_arns issue with aws_iam_role AWS CloudFormation:如何在 AWS::IAM::Policy 中引用另一个堆栈中定义的角色 - AWS CloudFormation: How to refer a role defined in another stack inside AWS::IAM::Policy AWS Secrets Manager 资源策略拒绝除一个角色外的所有角色 - AWS Secrets Manager Resource Policy to Deny all roles Except one Role 如何在 AWS 中定义仅允许使用预定义模板创建堆栈的策略/角色/权限 - How to define a policy/role/permission in AWS which only allows to create stack with a predefined template 使用 AWS-CDK 创建新的 IAM 角色时创建自定义信任策略 - Creating a custom trust policy when creating a new IAM role using AWS-CDK
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM