使用SCP限制根用户的行为
打开控制台的AWS Organizations。
打开菜单AWS accounts,打开Root也就是最顶端的组织;
在Policies页签下面,Service control policies,点击Attach;
创建一个新的策略:Deny-Root-Actions,内容填写
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Deny-Root-Actions",
"Effect": "Deny",
"Action": [
"*"
],
"Resource": [
"*"
],
"Condition": {
"ArnLike": {
"aws:PrincipalArn": [
"arn:aws:iam::*:root"
]
}
}
}
]
}
也可以加上限制条件,比如有MFA的情况可以使用root,其他情况拒绝:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyAllForRootIfNoMFA",
"Effect": "Deny",
"Action": "*",
"Resource": "*",
"Condition": {
"BoolIfExists": { "aws:MultiFactorAuthPresent": "false" },
"StringLike": { "aws:PrincipalArn": ["arn:aws:iam::*:root"] }
}
}]
}
绑定这个新创建的策略到Root上则完成通过SCP限制根用户的行为。
最后更新于