Policy evaluation and explicit deny
Default deny and explicit deny
In IAM, access is denied unless applicable permissions authorize the request. An applicable explicit Deny overrides an Allow. A statement that does not match is not an explicit denial. For the following beginner model, assume one same-account role session, only the shown identity policies, a normal S3 object, no other applicable restrictions or resource grants, and no extra encryption permissions needed.
Add a restriction
Suppose the reader policy from the previous lesson remains attached. Add a second illustrative policy which explicitly denies reading objects under reports/private/. It has no condition, so within its action/resource scope the deny also applies to secure requests.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::amzn-s3-demo-bucket1/reports/private/*" } ]}Follow three requests
For a secure read of reports/jan.csv, the Allow matches and no Deny matches: allow in this model. For a secure read of reports/private/payroll.csv, both match: explicit deny. For a write to reports/jan.csv, neither matches: implicit deny. Reordering the two statements does not change these outcomes.
Decision diagram: matching Deny? yes → explicit deny; otherwise matching Allow? yes → allow; otherwise implicit deny.
What the model leaves out
Real IAM decisions can involve resource-based policies, session policies, permissions boundaries, AWS Organizations controls and cross-account rules. Boundaries generally constrain identity-based grants rather than granting permissions; resource-policy interactions depend on the principal type and context. Do not generalize this simple algorithm to all AWS requests. An authorized investigation should identify the caller, exact action, resource, context and applicable policies; use approved policy validation and simulation tools, and verify actual behavior in a separately authorized environment. Do not solve a denial by granting administrator access.
Practice offline
Classify a non-secure read of reports/jan.csv and a non-secure read of reports/private/payroll.csv. The former has no matching Allow or Deny; the latter matches the explicit Deny. Explain the difference, then check the offline chapter lab. No AWS account is needed. Next: EC2 compute fundamentals.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Policy evaluation and explicit deny — knowledge check
Apply IAM concepts in fictional offline scenarios.
Both the report Allow and the private-prefix Deny match a secure read. What is the result?
No statement matches a write request in the simplified model. What is the result?
Does moving the private-prefix Deny below the Allow change the decision?
Why is the offline evaluator not a complete IAM simulator?
A legitimate report request is denied. Which first investigation is appropriate?