Course contentsShow
← Cloud and Infrastructure
Lesson 363 of 2,9897. Identity and Access ManagementFree lesson

Allow vs Deny Effects

Learn how explicit allow and explicit deny effects work and how deny always overrides allow.

Allow vs Deny Effects

What you'll learn: How explicit allow and explicit deny effects work in IAM policies, and why deny always wins when both are present.


The Two Permission Signals

In IAM policies, every statement includes an Effect that tells the system how to treat a permission request. There are only two possible effects:

  • Allow – grants permission to perform the specified actions
  • Deny – blocks permission to perform the specified actions

Think of these like traffic signals: Allow is a green light, Deny is a red light.

How They Interact

Here's the critical rule: Deny always overrides Allow, no matter where it appears.

Imagine you're trying to enter a building:

  • You have a keycard that allows you access (an Allow policy)
  • But there's also a security alert with your photo that denies you entry (a Deny policy)
  • The security guard will always follow the deny instruction, even though you have a valid keycard

Evaluation Flow

When you request access to a resource:

  1. The system checks all applicable policies
  2. If any policy contains an explicit Deny for that action → Access denied
  3. If there's no Deny, but at least one Allow → Access granted
  4. If there's no Deny and no Allow → Access denied (implicit deny by default)

This means a single Deny policy can override dozens of Allow policies. This design prioritizes security—it's easier to accidentally grant too much access than to accidentally block legitimate access.


Key Takeaway: Deny effects always override Allow effects in IAM policy evaluation, ensuring that explicit denials take precedence for security.