Sub topic 9
Permission boundaries: a ceiling on identity policies
This chapter assumes you know how default deny, explicit deny, and allow combine in the core evaluation rule. It also assumes you can read an identity-based policy and know what an IAM role and an ARN are. Here you will learn what a permission boundary does, how to work out effective permissions, where a boundary does not apply, and how to use one safely when you delegate IAM administration.
What a permission boundary is
A permission boundary is a managed policy that you set on an IAM user or an IAM role. It defines the maximum permissions that the principal's identity-based policies can give it. A boundary never grants anything itself. It only removes permissions that fall outside it.
Key facts:
- You can set a boundary on users and roles. You cannot set one on groups.
- A principal has at most one boundary.
- The boundary must be a managed policy, either AWS managed or customer managed. Inline policies cannot be boundaries.
- A boundary uses the same JSON grammar as any other policy:
Effect,Action,Resource, andCondition. It has noPrincipalelement, because it applies to whoever it is attached to. - A boundary limits only the identity side of the request. It does not limit resource-based policies in most cases (see below).
Effective permissions are the overlap
For a request evaluated within one account, an identity policy allow counts only if the boundary also allows the same action and resource. The result is the intersection of the two sets.
Suppose a role named ReportWriter has an identity policy that allows s3:* and ec2:DescribeInstances on all resources. Its boundary is the following policy.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "BoundaryCeiling",
"Effect": "Allow",
"Action": ["s3:GetObject", "s3:PutObject"],
"Resource": "arn:aws:s3:::example-reports-bucket/*"
}
]
}The boundary allows two actions on the objects in one bucket. The identity policy allows far more. Only the overlap survives.
| Request | Identity policy | Boundary | Result |
|---|---|---|---|
| `s3:GetObject` on `example-reports-bucket/a.csv` | Allow | Allow | Allowed |
| `s3:PutObject` on `example-reports-bucket/a.csv` | Allow | Allow | Allowed |
| `s3:DeleteObject` on `example-reports-bucket/a.csv` | Allow | Not listed | Denied |
| `s3:GetObject` on `other-bucket/a.csv` | Allow | Resource does not match | Denied |
| `s3:ListBucket` on `example-reports-bucket` | Allow | Not listed | Denied |
| `ec2:DescribeInstances` | Allow | Not listed | Denied |
Each denial is an implicit deny. Nothing in the boundary says "deny delete". The boundary simply never allows it, so the request fails the "both must allow" test.
Note the ListBucket row. The bucket itself has a different ARN from its objects. The /* in the boundary's Resource matches objects only, so a boundary written for objects will not cover bucket-level actions.
Boundaries do not grant
The most common mistake is to treat a boundary as a permission. Consider a role with a boundary that allows s3:GetObject but with no identity policy at all. That role can do nothing. The boundary raises a ceiling, but no allow exists below it.
The reverse also holds. If a user's identity policy allows only s3:GetObject and the boundary allows s3:*, the user can still do only s3:GetObject. The effective set can never be larger than either input.
Explicit denies inside a boundary
A boundary can contain Deny statements. They work like any explicit deny: they override every allow, and nothing can override them. A boundary with a broad allow and a few targeted denies is a common design. For example, a boundary can allow most services and then deny iam:* or deny actions outside approved Regions.
The usual evaluation order still holds. An explicit deny in any applicable policy ends the evaluation with a denial, and the boundary is one of the applicable policies.
Where a boundary does not apply
A boundary limits what an identity policy can grant. It is not a general filter on every way a principal might get access. The cases below matter most.
Resource-based policies naming the principal directly
Within a single account, a resource-based policy that names a user or role ARN as the Principal grants that principal access by itself. The boundary does not remove that grant, and no identity policy allow is needed. This is the case the boundary does not cover.
A resource-based policy that names the account root (arn:aws:iam::111122223333:root) works differently. It only delegates the decision to the account's IAM, so the identity policy and the boundary both still apply.
An explicit Deny in the boundary still wins in every case.
Cross-account access
A boundary applies in the account that owns the principal. When a role in account 222233334444 reads a bucket in account 111122223333, two checks must pass:
- The bucket policy in
111122223333must allow the role. - The role's identity policy in
222233334444must allow the action, and the role's boundary must allow it too.
Using the cross-account bucket policy from the earlier chapter, the ReportReader role needs s3:GetObject in its identity policy and in its boundary. A boundary that omits s3:GetObject blocks the request even though the bucket policy allows it.
Groups and service-linked roles
A boundary cannot be attached to a group. If you want a ceiling for everyone in a group, set the same boundary on each user. Service-linked roles are managed by AWS services and do not take boundaries.
Setting a boundary
You attach a boundary to an existing role with one call. The policy must already exist as a managed policy.
aws iam put-role-permissions-boundary \
--role-name ReportWriter \
--permissions-boundary arn:aws:iam::111122223333:policy/ReportBoundaryFor users, the equivalent is put-user-permissions-boundary. You can remove a boundary with delete-role-permissions-boundary. Removing one raises the ceiling immediately, so restrict who can call it.
The delegation pattern
The main reason to use boundaries is to let a team create roles and users without letting them escalate privileges. Without a boundary, anyone who can create a role and attach policies can create a role more powerful than themselves.
The fix is an identity policy for the delegated administrator that allows role creation only when the new role carries a specific boundary. The condition key iam:PermissionsBoundary checks the boundary named in the request.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CreateRolesOnlyWithBoundary",
"Effect": "Allow",
"Action": [
"iam:CreateRole",
"iam:PutRolePermissionsBoundary",
"iam:AttachRolePolicy",
"iam:PutRolePolicy"
],
"Resource": "arn:aws:iam::111122223333:role/team-*",
"Condition": {
"StringEquals": {
"iam:PermissionsBoundary": "arn:aws:iam::111122223333:policy/ReportBoundary"
}
}
},
{
"Sid": "DenyBoundaryRemoval",
"Effect": "Deny",
"Action": [
"iam:DeleteRolePermissionsBoundary",
"iam:DeleteRolePolicy"
],
"Resource": "arn:aws:iam::111122223333:role/team-*"
}
]
}Read it in two parts. The first statement lets the administrator create roles named team-* and manage their policies, but only if the request names ReportBoundary as the boundary. The iam:PermissionsBoundary key is evaluated against the boundary supplied in the request, so a request that omits it fails the condition and is denied. The second statement stops the administrator from removing a boundary after the fact.
The roles that the administrator creates can then be given any identity policy. Whatever they receive, their effective permissions can never exceed ReportBoundary.
Boundaries and other policy types
Boundaries sit alongside the other limiting policies, and the effects stack. A request must pass every limit that applies.
| Limit | Attached to | Limits |
|---|---|---|
| Permission boundary | One user or role | What that principal's identity policies can grant |
| Session policy | One temporary session | What the role's policies can grant during that session |
| Service control policy | An organization root, OU, or account | What principals in those accounts can be granted |
All of these are filters. At least one allow still has to come from an identity-based policy or a resource-based policy, and every applicable limit must also allow the request.
Troubleshooting a boundary
When a role has a broad identity policy but still gets AccessDenied, check these in order:
- Does the role have a boundary? Look at the role's details or run
aws iam get-role --role-name ReportWriterand readPermissionsBoundary. - Does the boundary allow the exact action, and does its
Resourcematch the exact ARN? Bucket ARNs and object ARNs differ. - Does the boundary contain a
Denythat matches? - Is the boundary's
Conditionsatisfied by this request?
The policy simulator accounts for boundaries, so it can show which policy causes a denial.
aws iam simulate-principal-policy \
--policy-source-arn arn:aws:iam::111122223333:role/ReportWriter \
--action-names s3:GetObject s3:PutObject \
--resource-arns arn:aws:s3:::example-reports-bucket/2026/summary.csvIn the output, each result shows EvalDecision. Look for the lines that mention the permissions boundary, such as PermissionsBoundaryDecisionDetail, to see whether the boundary allowed the action.
Exercise
A role has an identity policy that allows s3:GetObject, s3:PutObject, and s3:DeleteObject on arn:aws:s3:::example-reports-bucket/*. Its permission boundary allows s3:GetObject and s3:PutObject on the same objects and ec2:DescribeInstances on all resources. Which of these requests succeed: GetObject on a report, DeleteObject on a report, DescribeInstances? Assume no other policies apply.
Show answer
Only GetObject succeeds, along with PutObject if it were requested. GetObject is allowed by both the identity policy and the boundary. DeleteObject is allowed by the identity policy but not by the boundary, so it is an implicit deny. DescribeInstances is allowed by the boundary but not by any identity policy, and a boundary never grants, so it is also denied.
Exercise
In the same account, a bucket policy names the role's ARN as Principal and allows s3:DeleteObject on the objects. The role's boundary does not list s3:DeleteObject and contains no Deny statements. Does a delete request from the role succeed? What changes if the bucket policy names the account root instead?
Show answer
It succeeds. A resource-based policy that names the role ARN directly grants access on its own, and the boundary does not limit it. If the policy names the account root, it only delegates the decision to IAM in that account. The role's identity policy must then allow the delete, and the boundary must allow it too, so the request is denied.