Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

aws-iam — Claude Code skill: what it does, how to install

Verified corrections for the IAM mistakes agents keep making, plus step-by-step workflows for roles and baseline policies.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add aws/agent-toolkit-for-aws --skill aws-iam -a claude-code
Open on GitHub

What aws-iam does

The skill installs into Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode. SKILL.md holds the edge cases; two reference files go deeper, references/aws-iam-role-management.md on service and execution roles with their trust policies, references/aws-iam-policy-generation.md on building policies. The agent pulls a reference only when the conversation needs that detail.

For AWS calls it recommends the AWS MCP server, though the CLI or an SDK works too. Policy generation comes with a hard requirement: hand it application source in any language, or a terraform show -json plan, and it mandates iam-policy-autopilot instead of writing the policy by hand. No such tool, no generated policy — worth checking before you ask.

Edge cases come with examples. iam:PassRole on Resource: "*" sitting next to RunInstances, CreateFunction or RegisterTaskDefinition escalates to any passable role in the account, Administrator included, so catch that pattern in review. ForAllValues evaluates to true on an empty or missing key, which is why a Null condition on the same context key belongs beside it. Cognito user-pool policies and app-level RBAC fall outside the skill.

What it helps with

  • generate a baseline policy from app source or a terraform show -json plan
  • tighten a service role trust policy with aws:SourceArn conditions
  • catch iam:PassRole on Resource: "*" before it turns into escalation
  • explain why ForAllValues passes a request that carries no tags
  • sort out STS session limits under role chaining

Example prompts for the agent

  • Build a baseline policy for this Lambda from `src/handler.py` — which actions does it actually need?
  • Review the trust policy on our Glue role and add `aws:SourceAccount` and `aws:SourceArn` conditions.
  • Our `ForAllValues:StringEquals` on `aws:TagKeys` allows a request with no tags. Why?

How to install aws-iam

1Skills CLI (Vercel)

npx skills add aws/agent-toolkit-for-aws --skill aws-iam -a claude-code

2Manually: put the files in place

~/.claude/skills/aws-iam/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/aws-iam/

From the same set8

The whole set →
aws-serverless aws A router skill for AWS serverless work: it picks a compute form factor per component and hands off to the skill that owns it. Claude Code CX Codex Cursor +1 10,100installs aws-cdk aws A Claude Code skill that gives the agent AWS CDK expertise in TypeScript and Python: writing constructs, deploying stacks, importing existing resources, and reading CloudFormation failures. Claude Code CX Codex Cursor +1 9,400installs aws-containers aws Deploys containers on AWS: EKS, ECS, Fargate, ECR, Elastic Beanstalk. Use it when deploying, debugging, or optimizing containerized workloads. Claude Code CX Codex Cursor +1 9,300installs aws-billing-and-cost-management aws Analyzes AWS spending, discovers savings opportunities, and sets up budgets. Helps evaluate Savings Plans, detect cost anomalies, and right-size infrastructure. Claude Code CX Codex Cursor +1 8,900installs aws-cloudformation aws Takes CloudFormation templates from authoring to failed-stack post-mortem: local validation, cfn-guard checks, account-aware pre-deploy checks and root-cause tracing. Claude Code CX Codex Cursor +1 8,800installs connecting-to-data-source aws Builds and tests an AWS Glue connection to Oracle, PostgreSQL, Redshift, Snowflake or BigQuery, so a job does not discover the wiring is wrong at runtime. Claude Code CX Codex Cursor +1 6,800installs querying-data-lake aws A skill that runs SQL in Amazon Athena: it picks a workgroup, stops destructive statements for confirmation and reports what the query cost. Claude Code CX Codex Cursor +1 6,600installs

Similar

mantis-researcher official google Audits production source code against workspace/plan.json. It inspects target files for boundary checks, missing sanitization, and interface violations without modifying the codebase. Claude Code CX Codex Cursor +1 1,500installs browser-extract ruvnet Pulls text, tables and attribute values off a rendered page as structured JSON, with PII and prompt-injection checks running before anything reaches the model. Claude Code CX Codex Cursor +1 697installs browser-auth-flow ruvnet Drives your login flow once, then probes it for redirect leaks, missing CSRF tokens, weak session cookies and OAuth mistakes. Writes a findings.md with a verdict. Claude Code CX Codex Cursor +1 689installs reverse-engineer sickn33 Structured reverse engineering workflow for binaries: static decompilation, dynamic tracing, pattern detection, and automation scripts. Claude Code CX Codex Cursor +1 891installs okx-agentic-wallet okx This skill gives a coding agent the OKX Onchain OS wallet: balances, transfers, swaps, bridges, limit orders and contract calls, all through the onchainos CLI. Claude Code CX Codex Cursor +1 17,400installs varlock dmno-dev Instructs coding agents to manage secrets via Varlock, redact sensitive values in LLM context, and define configurations inside .env.schema. Claude Code CX Codex Cursor +1 747installs git-guardrails-claude-code Matt Pocock This skill adds a Claude Code hook that stops risky Git commands before they run. Use it when an agent must not push or discard working-tree changes. Claude Code 499,069installs ponytail-review DietrichGebert ponytail-review reviews a change beyond the diff, checking connected code, bugs, risks, load, tests, speed, and unnecessary code. Use it for PRs and commits. Claude Code CX Codex Cursor +1 56,300installs

Questions about aws-iam

How do I install aws-iam in Claude Code?

Run npx skills add aws/agent-toolkit-for-aws --skill aws-iam -a claude-code. The skill lands at ~/.claude/skills/aws-iam/SKILL.md.

What does aws-iam do?

It supplies corrections for the IAM behaviour agents get wrong: policy evaluation, trust policies, STS limits, Organizations, SAML and MFA. It also walks through role creation and policy generation.

What do I need to generate a policy from source code or a Terraform plan?

The skill requires iam-policy-autopilot for that flow and does not build the policy manually. Other AWS operations can go through the MCP server, the CLI or an SDK.

Source text

SKILL.md · Apache-2.0
---
name: aws-iam
description: >-
  Provides verified corrections for IAM behaviors that AI agents frequently get wrong
  — policy evaluation edge cases, trust policy gotchas, STS session limits, Organizations
  quirks, and SAML/MFA specifics. Also provides structured workflows for IAM role
  management and baseline policy generation from application source code or a Terraform
  plan JSON. Covers condition operator safety (ForAnyValue/ForAllValues with Null
  checks), bucket policy deny patterns (VPC endpoint restrictions, org paths), confused
  deputy protection, and service role creation for AWS services (Glue, CloudTrail,
  Lambda, ECS, etc.) with aws:SourceAccount/aws:SourceArn trust conditions. Applies
  when creating IAM roles, writing IAM or bucket policies, generating policies from
  application source code or a Terraform plan JSON, working with STS, Organizations,
  or condition operators, or any task needing a service or execution role. Does not
  cover non-IAM authorization like Cognito user-pool policies or app-level RBAC.
metadata:
  version: "3"
---

# AWS IAM — Common Pitfalls

## About This Skill

This skill contains verified corrections for things that AI agents frequently get wrong about IAM. It is not a comprehensive IAM guide — for full IAM guidance, search AWS documentation. When answering IAM questions, verify specific claims (limits, quotas, exact API names, edge-case behaviors) against official AWS documentation rather than relying on pre-training. Prefer fetching known documentation URLs over broad searches. Trust official documentation over memory when they conflict.

## Common Workflows

Use the best available tool for AWS operations — the AWS MCP server is recommended but not required; AWS CLI or SDK may be used as alternatives. Read reference files only when the conversation requires deeper detail.

- Read [references/aws-iam-role-management.md](references/aws-iam-role-management.md) if the user needs to create, scope, or maintain IAM roles when provisioning or updating AWS resources. Covers service roles, execution roles, trust policies, confused deputy protection, and permission hygiene.

- Read [references/aws-iam-policy-generation.md](references/aws-iam-policy-generation.md) if the user needs to generate IAM policies, determine required IAM actions for API calls, or understand action-to-operation mappings. **CRITICAL: If the user provides application source code (in any language) or a Terraform plan JSON file (`terraform show -json` output), you MUST read this reference — it mandates using iam-policy-autopilot instead of manual policy construction.** Uses the programmatic service authorization reference for accurate mappings.

## Verified Edge Cases

**CloudTrail:**

- AcceptHandshake/DeclineHandshake logged in ACTING account ONLY, not management account. Organization trail required for centralization.
- ConsoleLogin region varies by endpoint/cookies, NOT always us-east-1. `?region=` forces specific region.

**STS:**

- GetSessionToken restrictions: (1) No IAM APIs unless MFA included (2) No STS except AssumeRole and GetCallerIdentity.
- Cross-account AssumeRole to opt-in region: TARGET account must enable region, not calling account.
- Role chaining: max 1-hour session.

**Organizations:**

- Suspended/closed accounts CANNOT be removed until permanently closed (~90 days). Remove FIRST, then close.
- Policy management delegation: use PutResourcePolicy, NOT register-delegated-administrator.
- AI opt-out policies: management account required by default.
- Organizations policy types for ListPolicies filter: fetch the current list via `aws organizations list-available-policy-types` or [the Organizations API reference](https://docs.aws.amazon.com/organizations/latest/APIReference/API_ListPolicies.html).

**SDK Specifics:**

- Organizations: `DuplicatePolicyAttachmentException` (not PolicyAlreadyAttachedException).
- Boto3 IAM AccessKey: methods are `activate()`, `deactivate()`, `delete()` — NO `update()`.
- Instance profiles: waiter + `time.sleep(10)` pattern.
- Managed policy max versions: 5.

**SAML:**

- Encrypted assertions URL: `https://region-code.signin.aws.amazon.com/saml/acs/IdP-ID`.
- Private key from IdP uploaded to IAM in .pem format.

**Policy Evaluation:**

- ForAllValues with empty/missing key: evaluates to true (vacuous truth). To avoid that, use a `Null` condition in addition to the `ForAllValues` on **the same context key** to require that key to be present and non-null. For example, when evaluating the `aws:TagKeys` context key:

  ```json
  {
    "Version": "2012-10-17",
    "Statement": {
      "Effect": "Allow",
      "Action": "ec2:RunInstances",
      "Resource": "*",
      "Condition": {
        "ForAllValues:StringEquals": {
          "aws:TagKeys": ["Alpha", "Beta"]
        },
        "Null": {
          "aws:TagKeys": "false"
        }
      }
    }
  }
  ```

- `aws:TagKeys` values are case-sensitive, but the tag key in `aws:PrincipalTag/<key>`, `aws:ResourceTag/<key>`, and `aws:RequestTag/<key>` is not. The Allow allowlist above is unaffected (a re-cased key is simply not in the list), but a Deny that protects a tag key with `ForAnyValue:StringEquals` on `aws:TagKeys` is bypassed by a re-cased key (`PROTECTED-TAG`) — use `ForAnyValue:StringEqualsIgnoreCase`. See [references/common-pitfalls.md](references/common-pitfalls.md).
- Resource-based policies granting to IAM user ARN bypass permissions boundaries in same account.
- 8 privilege escalation actions via direct IAM policy manipulation: PutGroupPolicy, PutRolePolicy, PutUserPolicy, CreatePolicy, CreatePolicyVersion, AttachGroupPolicy, AttachRolePolicy, AttachUserPolicy.
- `iam:PassRole` with `Resource: "*"` + create/update on a compute service (EC2 `RunInstances`, Lambda `CreateFunction`/`UpdateFunctionConfiguration`, ECS `RegisterTaskDefinition`, Glue, SageMaker, CloudFormation, etc.) = privilege escalation to any passable role in the account, including Administrator. Scope `Resource` to specific role ARNs or an IAM path; optionally constrain with `iam:PassedToService` / `iam:AssociatedResourceArn`. See [IAM User Guide — Grant a user permissions to pass a role](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_passrole.html).

**MFA:**

- Unassigned virtual MFA devices auto-deleted when adding new ones.
- MFA resync-only policy NotAction needs exactly: iam:ListMFADevices, iam:ListVirtualMFADevices, iam:ResyncMFADevice.

**SigV4:**

- IncompleteSignatureException includes SHA-256 hash of Authorization header for transit modification diagnosis.

**Service-Specific Roles:**

- Redshift Serverless trust policy: include BOTH `redshift-serverless.amazonaws.com` AND `redshift.amazonaws.com` as service principals (per AWS docs; omitting serverless causes `Not authorized to get credentials of role` on COPY).
- IAM OIDC providers: thumbprints are not required for most providers (AWS verifies via trusted CAs).

**Policy Summary Display:**

- Single statement with multi-service wildcard actions (e.g. `codebuild:*`, `codecommit:*`) + service-specific resource ARNs: each resource appears ONLY under its matching service's summary (CodeBuild ARN under CodeBuild, etc.). A resource whose service prefix matches NO action in the statement is the only case where it appears in all action summaries ("mismatched resource").

© aws · Apache-2.0 · aws/agent-toolkit-for-aws

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor