AWS in 1 Min · Episode 22

How AWS IAM policy evaluation works

How AWS decides yes or no. Watch the one-minute video, then read the details.

David Gomez1:18 video · 3 min read

"One Allow and you're in." Often true, and that's what makes the exceptions so confusing. AWS doesn't look at one policy; it looks at every policy that applies to a request and combines them with a few fixed rules. Know those rules and "why am I getting AccessDenied?" stops being a mystery. This is part two; part one covered how to read a single policy.

Rule 1: everything starts denied

By default, every request is denied. This is the implicit deny: no policy has to say "no" for the answer to be no. An identity with no policies can do nothing. (The account's root user is the exception; it has full access.)

Rule 2: an Allow opens the door

To be allowed, a request needs an explicit Allow that matches the action and the resource. Within one account, for most resources, one Allow is enough, and it can come from either side:

  • an identity-based policy, attached to the user, group or role making the request
  • a resource-based policy, attached to the resource, such as an S3 bucket policy

Two notable exceptions: a role's trust policy and KMS key policies must themselves allow the principal. And across accounts, both sides have to agree: the identity policy in one account and the resource policy in the other.

Rule 3: an explicit Deny always wins

If any applicable policy contains a Deny statement that matches the request, the answer is Deny. It doesn't matter which policy holds it or how many Allows exist elsewhere. That makes Deny the right tool for hard rules, such as "nobody deletes the audit logs" or "nothing runs outside these Regions".

It's also the usual cause of the confusing case: your policy clearly allows the action, and it still fails. Somewhere, a Deny is matching.

Rule 4: guardrails set the ceiling

Some policy types never grant anything. They only limit what other policies can grant:

  • Service control policies (SCPs) in AWS Organizations limit what principals in an account can do.
  • Resource control policies (RCPs) in AWS Organizations limit access to the resources in your accounts.
  • Permissions boundaries set the maximum permissions for a single user or role.
  • Session policies limit one temporary session.

With these in place, an action must be allowed by the identity policy and by each guardrail that applies. An Allow in your role's policy does nothing if the organization's SCP doesn't also allow the action.

The short version

For a request inside one account, AWS effectively asks:

  1. Is there an explicit Deny in any applicable policy? Then deny.
  2. Is there an Allow, and do the guardrails (SCPs, RCPs, boundaries, session policy) permit it too? Then allow.
  3. Otherwise, implicit deny.

Conditions fit into this naturally: a statement only counts when its Condition matches the request. A Deny with a condition only bites when the condition is true.

Where AI fits

The same logic controls which AI models an identity can use. On Amazon Bedrock:

  • Put specific foundation model ARNs in the Resource of the statement that allows bedrock:InvokeModel, so a role can only call the models you approved.
  • Use the bedrock:InferenceProfileArn condition key on that statement so the model can only be invoked through a specific inference profile, for example the one your team uses for cost tracking or Region routing.
  • For an organization-wide rule, an SCP with an explicit Deny on inference actions for unapproved models overrides whatever individual accounts allow.

Bedrock's documentation includes example policies for each of these; start from those rather than writing from memory.

Quick recap

  • Denied by default: no Allow, no access.
  • An Allow opens the door, if every guardrail also permits the action.
  • An explicit Deny always wins, wherever it is.
AWS in 1 Min #22 · 1:18

Need an AWS expert on your team?

I'm David, an AWS expert and fractional cloud consultant. I work alongside your team to run your cloud and infrastructure: architecture, security, cost and day-to-day operations. You get senior AWS experience when you need it, without the cost of a full-time hire.

  • Architecture reviews and a clear plan for what to fix first
  • Security hardening: IAM, networking, audits
  • Lower AWS bills without slowing your team down
  • Hands-on help with AI workloads on AWS