An explicit Deny wins
DeniedNo Allow anywhere overrides it, however specific. This is the first rule of IAM evaluation and the answer to most access questions.
- Action
- s3:GetObject
- Resource
- arn:aws:s3:::my-bucket/reports/q1.pdf
- Principal
- arn:aws:iam::111122223333:role/App
- Accounts
- same account
Identity policy
{
"Version": "2012-10-17",
"Statement": [
{ "Sid": "AllowS3", "Effect": "Allow", "Action": "s3:*", "Resource": "*" }
]
}Resource policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyOutsideVpc",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}