I am trying to create a policy in AWS for restricting users to one region for creation of resource and in other regions, they should have readonly access. I am able to restrict them to one region using below deny policy. But now the complication has come to provide users with readonly access to all location.
I am new to AWS policies and struggling with this.
The current policy I use for restricting them to one location is
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": "*",
"Resource": "*",
"Condition": {
"StringNotEquals": {
"aws:RequestedRegion": [
"eu-east-2"
]
}
}
}
]
}
Can anybody throw some light on this.
You will not be able to do it with using your deny policy. The reason being that AWS access management first looks for any Deny policy.
The easiest way to accomplish this is the following:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:RequestedRegion": [
"eu-east-2"
]
}
}
}
]
}
A couple things to note