Lesson 3 of 4 AWS IAM and Access Troubleshooting

Applying IAM Policy Evaluation Logic

This lesson explains how every applicable policy is evaluated together when a request reaches AWS, and why the evaluation order explains most access problems.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify the policy types that apply to a request.
  • Apply the evaluation sequence, including explicit denies.
  • Explain why an administrator can still be denied.

Policy types

Several policy types can apply to one request. Identity-based policies (managed or inline) grant permissions to users, groups and roles. Resource-based policies grant permissions on a resource. Permissions boundaries set the maximum permissions an identity-based policy can grant to a user or role. Service control policies (SCPs) set the maximum permissions for principals in member accounts of an organisation, and resource control policies (RCPs) set the maximum permissions on resources in those accounts. Session policies passed when assuming a role limit that session. Boundaries, SCPs, RCPs and session policies never grant permissions; they only limit them.

Sort into groups

Grants or limits?

Exam skills 4.1.1

Decide whether each policy type can grant permissions or can only limit them.

Log in to try this activity Interactive activities are free with an account.

The evaluation sequence

AWS evaluates a request in the following order. The first rule that applies decides.

  1. Implicit deny

    By default, every request is denied (except for the root user's own account resources).

  2. Explicit Deny

    An explicit Deny in any applicable policy denies the request.

  3. SCPs and RCPs

    If an SCP or RCP applies and does not allow the action, the request is denied.

  4. Allow within the account

    A resource-based or identity-based policy must allow the action; a permissions boundary or session policy that applies must also allow it.

  5. Allow across accounts

    For cross-account requests, both the caller's identity-based policy and the resource-based policy (or role trust) must allow the action.

Two consequences appear constantly in exam questions. First, a Deny anywhere wins, so a broad Deny in an SCP cannot be overridden by an administrator's Allow. Second, SCPs do not affect the management account or service-linked roles.

The following diagram shows the sequence as a chain.

The policy evaluation sequence. Every request starts implicitly denied. An explicit Deny in any applicable policy denies it. SCPs and RCPs that apply must allow the action. Within the account, an identity-based or resource-based policy must allow it, along with any permissions boundary or session policy. Across accounts, both the caller's policy and the resource policy or trust must allow it.
An explicit Deny anywhere ends evaluation, whatever the later steps would allow.
Scenario questions

Allowed or denied?

Exam skills 4.1.1 · 4.1.2

Work out the result of IAM policy evaluation.

Log in to try this activity Interactive activities are free with an account.
Worked example

An administrator who cannot launch instances

A user with AdministratorAccess in a member account cannot launch instances in ap-south-1. The error message states that the action was denied by a service control policy. The OU's SCP denies all actions when aws:RequestedRegion is not eu-west-1 or eu-central-1. Because SCPs set the maximum permissions, the user's Allow cannot override the Deny. If the business needs the Region, the SCP must be changed by the organisation's administrators; nothing in the member account can fix it.

Check yourself

Can an SCP grant permissions?

Show answer

No. SCPs, RCPs, permissions boundaries and session policies only limit permissions.

Exam Tips

Remember for the exam

  • Explicit Deny always wins; default is implicit deny.
  • SCPs, RCPs, permissions boundaries and session policies limit but never grant.
  • Cross-account access needs both sides to allow.
  • SCPs do not affect the management account or service-linked roles.