【发布时间】:2021-11-24 21:25:32
【问题描述】:
我正在关注此 AWS 文档,了解如何根据区域拒绝访问 AWS 资源:https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_examples_aws_deny-requested-region.html
这是我的 IAM 政策,当我尝试访问该帐户时,我什至看不到下面“条件”中描述的区域资源。访问“eu-central-1”的 EC2 控制台时出错:You are not authorized to perform this operation
我的目标是限制对条件中不存在的区域的任何资源的访问。例如,我想对“eu-central-1”拥有完全访问权限,但对“ap-northeast-1”没有访问权限
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyAccessNotListedRegions",
"Effect": "Deny",
"NotAction": [
"cloudfront:*",
"iam:*",
"route53:*"
],
"Resource": "*",
"Condition": {
"StringNotEquals": {
"aws:RequestedRegion": [
"eu-central-1",
"eu-west-3",
"eu-west-2",
"eu-west-1"
]
}
}
}
]
}
【问题讨论】:
-
看到您创建了一个有效的策略。我可以建议您将其发布为答案吗?我已经删除了我的,因为它走错了方向。
-
是的,我会这么做的。
标签: amazon-web-services amazon-iam