
AWS IAM Policies Explained: Understanding Permissions and Access Control
A practical guide to AWS IAM policies and permissions, covering identity-based and resource-based policies, trust policies, permission boundaries, SCPs, session policies, and how AWS evaluates access.
AWS Identity and Access Management (IAM) controls who can access AWS resources and what actions they can perform.
IAM can feel complicated because access is rarely determined by a single policy. Identity policies, resource policies, trust relationships, permission boundaries, and organization-level controls can all affect the final authorization decision.
This article breaks down the IAM policy types that are most useful to understand and how they work together.
IAM Policies
An IAM policy is a JSON document that defines permissions. At its core, a policy answers three questions:
What action is allowed or denied? On which resource? Under what conditions?
A basic policy statement looks like this:
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::example-bucket/*"
}
The main elements are:
- Effect — Allow or Deny
- Action — the AWS API operation, such as s3:GetObject
- Resource — the AWS resource the permission applies to
- Condition — optional restrictions on when the permission applies
- Principal — identifies who is granted access in policy types where a principal is specified
The goal should generally be to grant only the permissions required for a workload to function. This is the principle of least privilege.
Identity-Based Policies
Identity-based policies are attached to IAM users, groups, or roles and define what those identities are authorized to do.
AWS provides AWS managed policies, while customer managed policies allow you to define permissions specific to your environment.
There are also inline policies, which are embedded directly into a single user, group, or role. Unlike managed policies, they aren't designed to be reused across multiple identities.
A useful way to think about an identity policy is:
What is this identity allowed to do?
Resource-Based Policies
Resource-based policies are attached directly to AWS resources.
Common examples include:
- S3 bucket policies
- KMS key policies
- SQS queue policies
- SNS topic policies
- Lambda resource-based policies
Unlike an identity policy, a resource policy can specify a Principal that is allowed or denied access.
The distinction is useful:
Identity policy: What can this identity access?
Resource policy: Who can access this resource?
IAM Role Trust Policies
Every IAM role has a trust policy.
A trust policy determines who or what is allowed to assume the role.
For example:
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
It is important not to confuse a trust policy with a permissions policy.
Trust policy → Who can assume the role?
Permissions policy → What can the role do after it is assumed?
This distinction is particularly important when troubleshooting role-related AccessDenied errors.
AssumeRole vs PassRole
These permissions sound similar but serve different purposes.
sts:AssumeRole
Allows a trusted principal to assume an IAM role and obtain temporary credentials through AWS Security Token Service (STS).
Principal → AssumeRole → IAM Role → Temporary credentials
iam:PassRole
Allows a principal to pass an IAM role to an AWS service.
For example, when configuring a Lambda function with an execution role, the identity creating the function may need permission to pass that role to Lambda.
A simple way to remember the difference:
AssumeRole: Use the role.
PassRole: Give the role to an AWS service.
Permissions Boundaries
A permissions boundary defines the maximum identity-based permissions an IAM user or role can receive.
If an identity policy grants several permissions but the boundary allows only a subset of them, the effective identity permissions are limited accordingly.
Identity-based permissions
∩
Permissions boundary
↓
Effective permissions
A permissions boundary does not grant permissions by itself. It acts as a guardrail.
Service Control Policies
Service Control Policies (SCPs) provide permission guardrails at the AWS Organizations level.
They can be applied to organizational units or accounts to restrict the permissions available within them.
AWS Organization
↓
SCP
↓
AWS Account
↓
IAM identities
Like permissions boundaries, SCPs do not grant IAM permissions. The identity still needs the required permissions through the appropriate IAM policies.
Session Policies
When temporary sessions are created using AWS STS, session policies can further restrict the permissions available during that session.
Conceptually:
Role permissions
∩
Session restrictions
↓
Session permissions
Session policies are useful when a temporary session should have fewer permissions than the role normally provides.
Policy Conditions
IAM policies can also make authorization dependent on request context.
Conditions can restrict access based on factors such as:
- source IP or network
- VPC endpoints
- resource and principal tags
- AWS Region
- AWS account or organization
- MFA
- secure transport
Conditions make it possible to move beyond simple resource-based permissions and implement more contextual access controls.
Explicit Deny and Implicit Deny
AWS authorization follows an important principle: access is denied unless it is allowed.
If there is no applicable permission granting an action, the request is implicitly denied.
An applicable explicit Deny is even stronger and takes precedence over an Allow.
AWS Request
↓
Applicable explicit Deny?
│
YES ───────────────→ DENY
│
NO
↓
Does policy evaluation allow it?
│
YES ───────────────→ ALLOW
│
NO
↓
DENY
Understanding this behavior makes troubleshooting IAM considerably easier.
Putting It Together
When AWS receives a request, several authorization controls may be relevant:
AWS Request
│
▼
Identity-based policies
Resource-based policies
│
▼
Permissions boundaries
Session policies
│
▼
Organization SCPs
│
▼
Conditions
│
▼
Authorization decision
/ \
ALLOW DENY
The exact evaluation logic depends on the principal and policy types involved, but this provides a useful mental model when investigating permissions.
Final Takeaway
IAM becomes easier to understand when each policy type has a clear purpose:
Policy / Control | Main question |
|---|---|
Identity policy | What can this identity do? |
Resource policy | Who can access this resource? |
Trust policy | Who can assume this role? |
Permissions boundary | What is the identity's permissions ceiling? |
SCP | What organization-level guardrails apply? |
Session policy | What should this temporary session be limited to? |
Conditions | Under what circumstances should access apply? |
The most important principle across all of them is least privilege: grant the permissions required for a task, keep the scope as narrow as practical, and understand which policy layer is responsible when access is denied.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article