AWS Builder Center

AWS IAM Policy Evaluation: Why Access Is Denied Even When Permissions Exist?

Attaching an IAM policy doesn't always guarantee access to an AWS resource. Understand how AWS evaluates permissions, how explicit denies work, and how to troubleshoot unexpected AccessDenied errors with practical examples.

AWS IAM Policy Evaluation: Why Access Is Denied Even When Permissions Exist?

Have you ever attached an IAM policy to a user or role, confirmed that the required permission exists, and still received an  AccessDenied  error?
This can be confusing, especially when you're starting to work with AWS.
The problem is that AWS IAM doesn't simply check whether a permission exists. It evaluates multiple policy types and authorization conditions before allowing an action.
Let's understand how this evaluation works and how to troubleshoot permission-related issues.

1. How Does AWS IAM Evaluate Permissions?

AWS Identity and Access Management (IAM) controls who can access AWS resources and what actions they can perform.
When a principal (IAM user, role, or federated identity) makes an API request, AWS evaluates the applicable authorization policies.
The basic principles are:
  • By default, requests are denied.
  • An applicable explicit Deny overrides an Allow.
  • An applicable Allow grants permission unless another applicable policy or authorization control restricts it.
In simple terms:
Explicit Deny > Allow > Implicit Deny
However, this is a simplified way to remember the rules, not the complete authorization algorithm.

2. Understanding the Different Policy Types

Several policy types can influence whether an AWS request is allowed.
Identity-based policies
These policies are attached to IAM users, groups, or roles. They define which actions the identity can perform on specified resources.
Resource-based policies
These policies are attached to resources such as S3 buckets, SQS queues, and KMS keys. They define which principals can access those resources.
Permissions boundaries
A permissions boundary defines the maximum permissions that an identity-based policy can grant to an IAM user or role.
It does not grant permissions by itself.
Service Control Policies (SCPs)
SCPs are managed through AWS Organizations. They define the maximum available permissions for accounts within an organization.
An SCP does not grant permissions by itself.
Session policies
Session policies can restrict permissions for a particular role session when temporary credentials are created.
Understanding these policy types is essential when troubleshooting authorization failures.

3. Practical Example: Why Is S3 Access Denied?

Imagine an IAM user has an identity-based policy that allows access to an S3 bucket.
For example:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-demo-bucket/*"
}
]
}
At first glance, the user should be able to download objects from the bucket.
But what happens if the bucket policy contains an explicit Deny?
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-demo-bucket/*",
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
}
}
]
}
This policy denies requests made without secure transport.
Even though the IAM user has an Allow policy, an HTTP request will be denied because the bucket policy explicitly denies insecure transport.
The solution is to use HTTPS rather than weakening the security policy.
This is a simple example of why checking only identity-based permissions is not enough.

4. How to Troubleshoot AccessDenied Errors

When an AWS API request fails, avoid randomly attaching AdministratorAccess or adding more permissions.
Follow a structured troubleshooting process.
Step 1: Identify the principal
Find out which IAM user or role is making the request.
For an AWS CLI session, run:
aws sts get-caller-identity
This identifies the AWS account and principal associated with the current credentials.
Step 2: Inspect attached IAM policies
Use:
aws iam list-attached-user-policies \
--user-name demo-user
For inline policies:
aws iam list-user-policies \
--user-name demo-user
For roles, use the corresponding role policy commands.
Step 3: Review the resource-based policy
For an S3 bucket:
aws s3api get-bucket-policy \
--bucket my-demo-bucket
Check for explicit Deny statements, principal restrictions, and conditions.
Step 4: Check the permissions boundary
Verify whether a permissions boundary restricts the actions that the identity-based policy allows.
Step 5: Check AWS Organizations SCPs
If the account belongs to an AWS Organization, review applicable SCPs for restrictions.
Step 6: Use the IAM Policy Simulator
The IAM Policy Simulator can help test whether specific actions are allowed or denied under the policies it supports.
It is a troubleshooting aid, not a guarantee that the real request will succeed. Some authorization contexts and resource-based policy behaviors require additional investigation.

5. Common IAM Troubleshooting Mistakes

Here are some mistakes that can make authorization issues harder to resolve:
  • Attaching AdministratorAccess without identifying the actual permission problem.
  • Checking only identity-based policies.
  • Ignoring explicit Deny statements.
  • Forgetting permissions boundaries and SCPs.
  • Overlooking resource-based policy conditions.
  • Assuming that a successful policy simulation guarantees a successful real API request.
A better approach is to identify the principal, requested action, resource, and applicable authorization controls before changing permissions.

6. Final Thoughts

AWS IAM authorization is more than attaching policies and granting permissions.
Understanding how AWS evaluates different policy types helps engineers troubleshoot AccessDenied errors systematically instead of making unnecessary permission changes.
For anyone working in Cloud Support, Cloud Administration, or DevOps, IAM policy evaluation is an important skill because a small authorization mistake can prevent an entire application workflow from functioning.
Discussion:
Have you ever faced an unexpected AccessDenied error in AWS even after attaching the required IAM permissions?
What was the actual cause?
Drop your experience and thoughts in the comments!
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article