I am working on S3 basket policy. The idea is to explicitly deny access to all IAM users in the account, except for those that are explicitly granted.
I found a blog post explaining how to restrict access to a specific user. It works well. However, I want to extend the syntax to include a second IAM user who will be allowed access. This is essentially an OR condition.
But I'm very new to JSON, and I'm not sure how to do this.
Here is a policy that works to restrict access to a single user:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
],
"Condition": {
"StringNotLike": {
"aws:userId": [
"AIDA<obfuscated id>:*",
"AIDA<obfuscated id>",
"111111111111"
]
}
}
}
]
}
Can someone help me modify the above JSON to allow the OR condition, where could I specify an additional user id that will be allowed?
AdvThanksance!