Skip to navigation

Claude Code Cloud IAM: Permission Boundary Reviews

In short: Cap infrastructure agent identities with IAM policies and permission boundaries, then test allowed actions before production use.

Published 21 min read
On this page

Direct answer

A permission boundary is an AWS IAM policy that sets the maximum permissions an identity-based policy can grant, and it works as a ceiling rather than a grant of access. For a Claude Code infrastructure agent, the useful pattern is to design the largest set of cloud actions the agent could ever legitimately need, attach that as the boundary, then grant the agent only the subset a given task requires through its identity policy. The boundary stops an over-broad identity policy from accidentally making the agent an administrator. It does not approve anything, and it does not replace a human in the apply decision.

The concrete win is a hard ceiling on blast radius. Even if a prompt injection or a bad template convinces the agent to request iam:CreateAccessKey for itself, a boundary that omits IAM write actions blocks it. What the ceiling costs is visibility: a boundary does its work silently, so teams forget it exists and grant identities that already sit inside it without asking whether the ceiling itself is still right. Boundary review is therefore a periodic governance task, not a one-time setup step.

Why an agent identity needs a ceiling

Claude Code acts on cloud resources through an identity: an IAM role assumed in a CI job, a role assumed through an SSO session, or a user with access keys on a workstation. Whatever the identity, the agent’s effective permissions are whatever that identity’s policies grant. OWASP guidance on AI coding tools treats agent output as untrusted and recommends least privilege, which in IAM terms means the identity policy should be as narrow as the task allows.

Narrow identity policies are hard to maintain. A team starts with PowerUserAccess “temporarily,” then a quarter later the agent still has it. A permission boundary attacks that drift from the other direction. Attach a boundary that names the maximum action set once, and every identity policy inside it is capped. An engineer can grant s3:* to the agent identity and the boundary will still refuse s3:PutBucketPolicy on a bucket that holds production data, if the boundary omits it.

Two misconceptions cost teams time. A boundary is not a grant. An identity with only a boundary attached has no permissions at all, because the boundary caps what identity policies may grant and grants nothing on its own. And a boundary does not grant permissions by omission at the account level. Service control policies at the organization level are a separate mechanism, covered in a later section.

Evidence and its limits

Official, F022: AWS documents identity-based policies as defining permissions for AWS resources. Policy evaluation also depends on other applicable controls and the target service, so a policy statement is one input to the final authorization decision.

Official, F023: AWS describes permissions boundaries as setting the maximum permissions an identity-based policy can grant. A boundary works as a ceiling, not an automatic permission grant, and it cannot add a permission that no identity policy grants.

Official, F024: AWS service control policies can specify maximum permissions for accounts in an organization. Organization policy coverage and exceptions depend on the actual account structure, and not every service is covered by every control.

Official: The dedicated AWS IAM permission boundaries page was not fetched in full during the research pass behind this post. Version-specific evaluation details, supported resource types and edge cases should be rechecked against current AWS documentation before relying on a fine detail.

Official: The AWS Cost Management IAM controls reference covers the IAM permissions that gate billing and cost-management APIs, which matters when the agent also proposes resources with a cost dimension.

Official: For cluster workloads, the Kubernetes RBAC reference is the equivalent identity-control surface. IAM and RBAC are separate systems, and a multi-cloud or multi-platform agent may need both reviewed. The Kubernetes RBAC least privilege guide covers the cluster side.

Official: Claude Code security documentation describes permission modes and sandboxing as available safeguards on the local harness. Those controls constrain what the agent can do on the workstation. They do not constrain what the cloud identity it uses can do, which is the problem a permission boundary addresses.

Independent: OWASP Secure Coding with AI recommends least privilege and human review for agent-driven infrastructure changes.

No specific IAM policy evaluation trace, no benchmark and no measured reduction in access is reported here. Every authorization outcome depends on the account’s actual policy set.

Evidence map showing that a permission boundary caps what an identity policy can grant but does not itself grant access or replace human approval.
Editorial evidence map based on F022 and F023. A boundary limits what an identity can receive; it does not replace a narrow identity policy. Labels are the post author’s.

Agent identity model

Before designing a boundary, name the identities Claude Code actually uses. A single “the agent” identity is the anti-pattern that makes boundaries hard to reason about.

Identity type Credential source Permitted scope
CI pipeline role Assumed via OIDC from the CI provider Plan and apply in specific environments
Human SSO role Assumed through the identity provider Interactive plan, apply with approval
Workstation role Local credentials or SSO session Development accounts only
Break glass user Emergency access key, sealed Production, time-boxed, audited

For agent work, the identities that matter are the ones a pipeline or an interactive session assumes. A CI role is the highest-risk one, because it acts without a human watching. A workstation role is lower risk only if it is scoped to non-production accounts. The break glass incident access guide covers the emergency path separately, because emergency access has different rules.

Ask Claude Code to enumerate which identities it can assume in a given repository before proposing IAM changes. The agent can read the CI configuration and report the role ARNs it would use. It cannot verify the trust policy on those roles or the policies attached to them without IAM read access, and it should not have IAM read access by default.

Identity policies

An identity policy is the grant. It is attached directly to the role or user, and it names the actions the identity may perform. For an agent, the identity policy should be task-scoped rather than role-scoped: a role that can only plan reads from state and lists resources, and a separate role that can apply, gated behind approval.

Task-scoping has a cost. More roles mean more trust policies to maintain and more role assumptions in CI configuration. The benefit is that the apply role can be gated on a separate approval step, and the plan role can be attached to the agent identity without any apply capability at all. A role that can both plan and apply is the identity that lets an agent self-approve a production change, which is the specific anti-pattern this post avoids.

The RACI for infrastructure changes guide covers the accountable-human requirement for apply actions. The IAM mechanism that enforces it is separation: the agent identity plans, a human identity applies.

Permission boundaries

A boundary policy is attached to a role or user with the same mechanism as a permissions policy, but its semantics are inverted. Where an identity policy grants, a boundary caps. AWS evaluates both, and the effective permission is the intersection: an action must be granted by an identity policy and allowed by the boundary to succeed.

Intersection is what makes boundaries useful as a governance tool. A boundary can be broad enough to cover a whole team’s legitimate needs, attached once, and left alone. Individual identity policies can then be narrow and task-specific without anyone worrying that a typo grants *:*. The ceiling holds regardless of what the identity policy says.

Requested action Identity policy result Boundary result Effective access
ec2:DescribeInstances Allow Allow Allowed
ec2:TerminateInstances Allow Allow Allowed
ec2:TerminateInstances Allow Deny (implicit) Denied
iam:CreateUser Allow Deny (implicit) Denied
s3:GetObject Deny (not granted) Allow Denied

Note the last row. A boundary that allows everything still grants nothing, because the identity policy must also grant the action. Reading the table bottom-up, the intersection rule means a boundary is a cap on top of grants, never a substitute for them.

A boundary is also not a time limit. It does not expire, and it does not create an approval workflow. The security exception expiry guide covers how to attach expiry and ownership to access that needs it.

Organization guardrails

Service control policies operate above individual accounts. They specify maximum permissions for accounts in an organization, and they apply regardless of what any individual identity policy grants. A boundary is per-identity. An SCP is per-account or per-organizational-unit.

The two mechanisms are complementary. A boundary on the agent role caps what the agent identity can do inside its account. An SCP caps what any identity in that account can do, including the agent, including a break glass user. For a team running Claude Code in a production account inside an organization, the SCP is the wider net and the boundary is the tighter one. Coverage, though, depends on the account structure, and assuming an SCP handles a service it does not cover leaves a gap.

Organization policies do not cover every service, and they have their own exceptions. A team that assumes “the SCP handles it” without checking which services the SCP covers will find gaps. Ask the platform team for the SCP list and the organizational unit placement before assuming any protection is in place.

The policy as code audit-before-deny guide covers the equivalent preventive controls in Azure, where the mechanism differs but the rollout discipline is the same.

Task-scoped roles

Workflow from enumerating agent identities through designing the boundary, attaching task-scoped roles, running simulate-principal-policy, then routing apply through a separate human approval.
Editorial workflow based on F022 and F023. The sequence describes a reviewable IAM design routine; it is not an official AWS procedure.

Designing the role set for an agent starts with the actions the agent legitimately needs, classified by risk. The risk tiered infrastructure approvals guide covers classifying changes by blast radius, and the same tiers map cleanly onto IAM roles.

Cloud action Task need Maximum boundary permission
Read resource state Plan, drift detection *:Describe*, *:Get*, *:List* on relevant services
Create or update non-production resources Feature development Write actions on dev-account resources
Apply to production Deployment Write actions gated on approval role
Modify IAM or billing None for routine agent work Omit from the boundary entirely

The last row is the one to get right. An agent that proposes infrastructure does not need to modify IAM, create users, or change billing. Omitting those from the boundary means a compromised agent identity cannot escalate its own access or incur unbounded spend through IAM changes.

A boundary that omits IAM write actions also blocks the specific attack where an agent creates a new access key for itself. The cost of omitting them is that a human has to perform legitimate IAM changes through a separate identity, which is the correct arrangement anyway.

Allowed action tests

The most common IAM failure is a policy that looks right and fails the first time it is exercised, or worse, allows something the team believed was blocked. Testing the boundary before production use is a concrete step, and AWS provides the tooling for it.

aws iam simulate-principal-policy evaluates a principal against a list of actions and reports Allow or Deny for each, using the actual policy set including boundaries. It is the closest thing to a unit test for IAM.

bash
aws iam simulate-principal-policy \
--policy-source-arn arn:aws:iam::123456789012:role/claude-code-agent \
--action-names ec2:DescribeInstances ec2:TerminateInstances iam:CreateUser s3:GetObject \
--query 'EvaluationResults[*].{Action:EvalActionName,Decision:EvalDecision}'

The pass condition is concrete. Every action the agent legitimately needs returns Allow. Every action the boundary should block, including iam:CreateUser and any action outside the task scope, returns Deny. A simulation that does not cover the denial cases is not a test, it is a confirmation of the happy path.

Run the simulation after every boundary or identity policy change, and record the output in the change packet. The simulation output is evidence, and it is cheap to produce. Teams that rely on production traffic to discover IAM failures pay for that discovery in failed deployments.

Requested action Policy result Expected human approval
Read state and list resources Allowed, no approval None, plan is read-only
Apply to dev account Allowed CI approval gate
Apply to production Blocked for agent identity Human applies via approval role
IAM or billing change Blocked by boundary Out-of-band human action

Approval separation

The design rule this post keeps returning to: no single identity should hold plan, approve and apply. The agent identity plans. A separate approval mechanism, which can be as simple as a human clicking approve in a CI pipeline, authorizes the change. A separate apply identity, or the same CI role gated on the approval step, executes.

A permission boundary supports this design but does not create it. The boundary can omit the actions that would let the agent identity approve its own work, and the CI pipeline can require a manual approval gate before assuming the apply role. Both are needed. A boundary alone does not add a human to the loop, and an approval gate alone is only as strong as the identity that bypasses it.

Presenting a tool decision event as business approval is the specific failure this section prevents. Claude Code may record that a tool call was permitted by configuration or by a user decision, and that record is not a business change approval. The SOC 2 change evidence guide covers the evidence packet structure that separates technical permission from business approval.

Periodic boundary review

A boundary set on day one describes the actions the team thought the agent would need on day one. Six months later the agent’s responsibilities have grown, or shrunk, and the boundary is stale in one of two directions. Too permissive, and the ceiling no longer reflects reality. Too restrictive, and engineers work around it by granting exceptions that accumulate.

The review cadence is a governance choice, not something AWS sets. A quarterly review aligned to access recertification is a common pattern. The review questions are concrete: which actions in the boundary has the agent actually used, which has it never used, and which new actions does a current project need.

Claude Code can help with the review by producing a CloudTrail-based action summary for the agent role over the review window, if the team has CloudTrail enabled and the agent role is identifiable. The agent can read the export and produce a used-versus-granted table. Reviewing the table and deciding what to remove is a human decision.

Review question Evidence source Action on a gap
Which granted actions were used CloudTrail for the role ARN Consider removing unused grants
Which boundary actions were never attempted Same export Consider narrowing the boundary
New actions a project needs Project plan and CI config Propose a boundary change
Identities that use the boundary IAM role attachment list Recertify or remove stale identities

The access recertification guide covers the broader identity review process, of which boundary review is one part.

Tradeoff between a tight permission boundary that limits blast radius and the maintenance cost of reviewing it as agent responsibilities change.
Editorial tradeoff diagram based on F022 and F023. A narrow boundary caps damage; the trade is keeping it current as the agent’s task set evolves.

The concrete win, loss and implication

The concrete win is a ceiling that holds regardless of identity policy drift. Once the boundary is attached and omits IAM write actions, no identity policy inside it can grant the agent the ability to create users, keys or roles. A prompt injection, a bad template or a careless broad grant cannot escalate the agent into an administrator.

The concrete loss is the false security of a boundary nobody reviews. A boundary attached once and never revisited can be far broader than the agent’s actual needs, and the intersection rule means the effective permission is whatever the narrower of the two allows. A boundary that has not been tested with simulate-principal-policy is a claim, not a verified control.

The practical implication is that agent IAM is a two-layer design problem. Layer one is the identity policy: task-scoped roles that separate plan from apply and keep the agent out of the approval path. Layer two is the boundary: the ceiling that caps what any identity policy inside it can grant. Teams that only do layer one rely on every future engineer to write narrow policies. Teams that only do layer two have a ceiling with nothing granted beneath it.

Checklist before production use

Check Pass condition If it fails
Identities enumerated Every role the agent can assume is named Read CI config and trust policies
Boundary attached Boundary policy ARN on the agent role Attach before granting any policy
IAM write omitted Boundary denies iam:CreateUser, iam:CreateAccessKey Fix the boundary
Simulation run simulate-principal-policy output matches intent Run the simulation, record the output
Plan and apply separated Agent identity cannot assume the apply role without approval Split the roles
Approval outside the agent A human gate exists that the agent cannot bypass Add the CI approval gate
Review cadence set Named owner and next review date on the boundary Assign an owner
Control checklist covering identity enumeration, boundary attachment, IAM write omission, policy simulation, plan and apply separation, approval gating and review cadence.
Editorial control checklist derived from F022 and F023. Passing it shows the identity was reviewed honestly; it does not prove every edge case in a live authorization path.

Working with Claude Code on IAM

Give the agent three inputs: the identity it may assume, the boundary policy to propose, and the simulation command to run. Ask for a simulate-principal-policy output covering both the allowed and the denied actions, and ask it to report which actions are in the boundary rather than a summary judgment about whether the identity is safe. If the agent’s report claims the boundary is safe without showing the simulation output, that is the pattern the false success guide describes: a passing claim without the check that proves it.

Reviewing the proposal is the reviewer’s job. The agent can read CI configuration and draft a boundary policy, but deciding which actions a production agent identity should ever hold is a security and governance decision. The Claude Code verification guide covers the review questions, and the infrastructure threat model guide covers modeling what happens when agent credentials are compromised or over-scoped. Where the agent’s task list spans multiple environments, the parallel agents worktree guide covers keeping concurrent sessions from conflicting on the same files.

Governance around the identity

IAM design sits inside a governance process that decides who owns the boundary, who approves exceptions and how often access is revisited. Three posts in this batch cover the surrounding structure. The platform governance council charter guide covers the council that owns standards and risk acceptance. The security exception expiry guide covers attaching expiry to any access that cannot be removed outright. The runbook ownership guide covers the documentation an on-call engineer needs when the boundary blocks a legitimate action at 3 a.m.

Cost is a separate axis. The agent’s identity can grant expensive resources without any IAM control noticing, which is why the cloud budget and quota guardrails guide belongs in the same design conversation. A boundary that omits IAM write actions still permits creating a large cluster, and only a budget or quota control catches that. Where an agent’s task set overlaps with a Kubernetes control plane, the pod security admission guide covers the equivalent cluster-side gate.

Incident response changes the rules temporarily. The NIST-aligned incident tabletop guide covers rehearsing the escalation path, and the SOC 2 change evidence guide covers the packet that records what was done and who approved it. Both apply to IAM changes made under time pressure. When a freeze is in effect, the change freeze and emergency change guide defines which IAM changes qualify as emergency work. On the cluster side, the Kubernetes server-side apply ownership guide covers field ownership before an agent applies a manifest, and the terraform state access controls guide covers locking and access for the state the agent reads.

Data gap and future update

Verdict that designing the maximum action set first and granting only the task subset keeps an agent identity inside a reviewable ceiling.
Editorial verdict based on F022 and F023. Cap the identity first, grant narrowly second, and test the result with simulate-principal-policy before production use.

The dedicated AWS IAM permission boundaries page and the AWS Cost Management IAM controls reference were not fetched in full during the research pass behind this post. Resource-type-specific evaluation details, boundary behavior with resource-based policies and cross-account access, and any service-specific exceptions should be rechecked against current AWS documentation before relying on a fine detail. The ceiling semantics in F023 and the SCP maximum-permission behavior in F024 are documented AWS statements.

No measured reduction in access, no simulated attack demonstration and no specific policy evaluation trace is reported here. A future update quantifying how often agent identities trigger boundary denials in a real environment would need CloudTrail data and a defined observation window. No such data was collected.

Azure, GCP and Kubernetes equivalents are out of scope for this post beyond the RBAC cross-reference. The policy as code audit-before-deny guide covers Azure’s preventive policy mechanism separately.

One AI API Key option for OpenAI-format agents

Claude Code uses an Anthropic-format route, so the One AI free model IDs are not a Claude Code model source. The packet records Claude IDs as unavailable on 2026-11-27.

OpenAI-format agents have a separate route: One AI API Key offers https://api.oneaiapikey.com/v1, one key, and 46 live free IDs. It is a different client and request format, not a workaround for Claude Code authentication. Check the free model list and eligibility notes before choosing an agent route, or read the quickstart for the request shape.

FAQ

Does a permission boundary grant access on its own?

No. A boundary caps what an identity policy can grant. An identity with only a boundary attached has no permissions, because the boundary allows nothing that an identity policy does not also grant.

Can Claude Code propose its own permission boundary?

It can draft one, and a human should review and attach it. IAM write actions should sit outside the agent identity’s own boundary, so the agent cannot modify the boundary that constrains it.

How is a boundary different from a service control policy?

A boundary is attached to an individual role or user and caps what that identity can receive. An SCP applies to accounts in an organization and caps what any identity in those accounts can do. They operate at different layers and are complementary.

What is the fastest way to test a boundary?

aws iam simulate-principal-policy with the agent role ARN and a list of actions covering both allowed and denied cases. The output is per-action Allow or Deny and is the closest thing to a unit test for IAM.

Does a boundary expire or enforce approval?

No. A boundary is a static ceiling. Time limits and approval workflows are separate mechanisms that must be designed and enforced outside the boundary.

More from this batch

More Claude Code troubleshooting

More Claude Code troubleshooting

Sources

More in Blog

Try it

One API key for GPT, Grok, DeepSeek, Kimi, GLM, MiniMax, Qwen, Step, Beam, Nemotron, ERNIE, Hunyuan, Gemma, Laguna, LFM, LongCat, Llama, Solar, Jais, Mistral, K2 and Roleplay.

One AI API Key speaks the OpenAI and Anthropic formats, so you change the base URL and the key, not your code. Credit packs start at $10, and every model has a published per-token rate.

New accounts$10 credit on sign-up
Claim $10 credit →