Course contentsShow
← Security
Lesson 1715 of 3,05235. Cloud Security - IAMFree lesson

Policy Evaluation Logic and Precedence

Master how multiple policies combine, the deny-by-default model, explicit denies, and policy evaluation order.

Policy Evaluation Logic and Precedence

You'll learn how cloud providers combine multiple IAM policies and determine whether to allow or deny a request.

The Deny-By-Default Foundation

Cloud IAM starts from a position of implicit deny: unless explicitly granted, every action is blocked. This zero-trust baseline means your policies must affirmatively permit actions. If no policy statement matches your request, access is automatically denied.

Think of it like a secure building where every door is locked by default — you need the right key (permission) to open any door.

The Explicit Deny Trumps All Rule

When evaluating whether to allow an action, the IAM engine follows a strict precedence hierarchy:

  1. Explicit Deny — If any policy contains an explicit "Deny" statement matching the request, access is immediately blocked. Period. No other policy can override this.
  2. Explicit Allow — If at least one policy explicitly allows the action and no explicit denies exist, access is granted.
  3. Implicit Deny — If no policies address the action at all, access is denied by default.

Policy Evaluation Order

The IAM service evaluates all applicable policies — identity-based policies attached to the user, group policies, role policies, and resource-based policies. It doesn't stop at the first match; it examines every relevant policy to check for explicit denies.

This means even if you're granted broad permissions through a managed policy, a single explicit deny in an inline policy or permission boundary will block that action.

Analogy: Imagine collecting votes where a single "no" vote (explicit deny) vetoes the entire decision, regardless of how many "yes" votes (allows) you receive.

Key Takeaway: Policy evaluation follows a strict precedence: explicit denies always win, then explicit allows are checked, and finally implicit deny serves as the default — always evaluate all policies before making an access decision.