AWS IAM Policy Evaluation — Examples of Each Policy Type
Explicit deny, identity policies, resource policies, SCPs, permission boundaries and session policies.
AWS authorization is based on evaluating multiple policy types together. The important distinction is that some policies grant permissions, while others only restrict the permissions already granted.
Let’s use a common scenario: an IAM role named AppDeveloperRole attempting to access an S3 bucket named company-finance-data.
1. Explicit Deny — Always Wins
An explicit Deny in any applicable policy overrides an Allow from another policy.
Example: A developer has permission to read all S3 buckets, but a policy explicitly denies access to the finance bucket.
{
"Effect": "Deny",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::company-finance-data/*"
}
Even if another policy allows s3:*, the developer cannot read objects from this bucket.
Key principle: Explicit Deny overrides Allow, regardless of which applicable policy contains the deny.
2. Identity-Based Policies — Permissions Attached to Users or Roles
These policies are attached to IAM users, groups, or roles.
Example: An application role needs permission to read objects from a specific S3 bucket.
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::company-finance-data/*"
}
The role can now read objects, assuming no other applicable policy restricts the operation.
Key principle: Identity policies specify what actions an IAM principal is allowed to perform on which resources.
3. Resource-Based Policies — Permissions Attached to Resources
These policies are attached directly to supported AWS resources, such as S3 buckets, KMS keys, SQS queues, and IAM roles through trust policies.
Example: An S3 bucket in Account A grants a role from Account B permission to read its objects.
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::222222222222:role/AnalyticsRole"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::company-finance-data/*"
}
The bucket policy grants the external role access.
For ordinary cross-account access, the external role also needs permission from its own account, and applicable restrictions must permit the request.
Key principle: Resource policies specify who can access the resource, including principals in other AWS accounts.
4. Service Control Policies (SCPs) — Organization-Level Guardrails
SCPs are managed through AWS Organizations and apply to principals in member accounts.
They establish the maximum available permissions for those principals but do not grant permissions themselves.
Example: Your organization prohibits disabling CloudTrail.
{
"Effect": "Deny",
"Action": [
"cloudtrail:StopLogging",
"cloudtrail:DeleteTrail"
],
"Resource": "*"
}
Even an IAM role with AdministratorAccess cannot perform these actions in an affected member account.
SCPs can be attached at the organization root, organizational unit (OU), or account level. They do not restrict principals in the management account, and they do not restrict service-linked roles.
Key principle: SCPs define the maximum permissions available within AWS Organizations member accounts.
5. Permissions Boundaries — Maximum Permissions for an IAM Principal
A permissions boundary is a managed IAM policy attached to a user or role.
It limits the permissions that identity-based policies can grant.
Example: A developer role has an identity policy allowing s3:*, but its permissions boundary allows only S3 read operations.
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": "*"
}
The result:
| Operation | Identity policy | Boundary | Result |
|---|---|---|---|
s3:GetObject |
Allow | Allow | Allowed |
s3:ListBucket |
Allow | Allow | Allowed |
s3:PutObject |
Allow | No Allow | Denied |
s3:DeleteObject |
Allow | No Allow | Denied |
This is especially useful when delegating IAM administration to development teams.
Important nuance: Some resource-based policy grants directly to IAM users or assumed-role sessions can bypass an implicit deny in a permissions boundary. Explicit denies still apply.
6. Session Policies — Temporary Restrictions on Assumed Roles
Session policies are supplied when creating temporary credentials through AWS STS, such as with AssumeRole.
They further restrict the permissions available to that session.
Example: An administrator assumes a role that normally permits s3:*, but the session is restricted to reading objects.
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::company-finance-data/*"
}
The role itself may have broad S3 access, but this particular assumed-role session is limited to reading objects from the specified bucket.
Key principle: Session policies restrict temporary sessions without changing the underlying IAM role.
How AWS Evaluates These Policies Together
A useful simplified model for identity-based authorization is:
Here, the intersection means that each applicable limiting policy must permit the action. An omitted boundary or session policy imposes no additional restriction. Resource-based permissions are evaluated alongside this model and can change the result in certain cases.
Quick Comparison
| Policy type | Grants permissions? | Primary purpose |
|---|---|---|
| Explicit Deny | No | Forbid specific operations |
| Identity policy | Yes | Authorize users and roles |
| Resource policy | Yes | Authorize access to resources |
| SCP | No | Organization-wide permission ceiling |
| Permissions boundary | No | Limit an IAM user or role |
| Session policy | No | Limit temporary credentials |
One additional policy type worth knowing is the Resource Control Policy (RCP). Like SCPs, RCPs are AWS Organizations guardrails, but they restrict access to supported resources in member accounts rather than primarily restricting principals.
takeaway: An IAM identity policy saying Allow is not sufficient to guarantee access. AWS evaluates applicable explicit denies, organization guardrails, permissions boundaries, session policies, resource policies, and other service-specific controls before authorizing a request.