New to Claude Skills? Learn how to install them →

aws on GitHub

AWS IAM

OfficialFree

Streamline AWS IAM role and policy management.

by aws2.3k stars on aws/agent-toolkit-for-aws
3 views
Updated Aug 10, 2026
Get this skill

Free · Opens the source repo

What AWS IAM does

The AWS IAM skill provides developers and designers with verified corrections and insights into common pitfalls associated with AWS Identity and Access Management (IAM). This skill is particularly useful for those who frequently work with IAM roles, policies, and the intricacies of AWS service authorization. It offers structured workflows for managing IAM roles and generating least-privilege policies, ensuring that users can effectively provision and update AWS resources while adhering to security best practices.

The skill covers a range of topics, including trust policies, confused deputy protection, and specific behaviors of AWS services such as CloudTrail, STS, and Organizations. It addresses edge cases that AI agents often misinterpret, such as session limits, policy evaluation nuances, and SAML/MFA specifics. By relying on the skill, users can avoid common errors and streamline their IAM configurations, ultimately enhancing their AWS security posture.

This skill is designed for developers, DevOps engineers, and security professionals who need to create, manage, or audit IAM roles and policies within AWS. It emphasizes the importance of using accurate references and official documentation to validate IAM-related claims, making it a reliable resource for those looking to deepen their understanding of AWS IAM functionalities. Whether generating policies or troubleshooting IAM issues, this skill equips users with the knowledge needed to navigate AWS IAM effectively.

In summary, the AWS IAM skill is an essential tool for anyone involved in AWS resource management, providing critical insights and workflows that help ensure compliance with least-privilege principles while mitigating common IAM-related risks.

When to use it

Use this skill when creating or managing IAM roles and policies, especially in complex AWS environments.

When not to use it

This skill does not cover non-IAM authorization methods like Cognito user-pool policies or app-level RBAC.

What you can build with it

Generating Least-Privilege Policies

Utilize the skill to generate IAM policies that adhere to least-privilege principles, ensuring secure access to AWS resources.

Managing IAM Roles

Leverage the structured workflows to create and maintain IAM roles, including service roles and execution roles for AWS services.

Troubleshooting IAM Issues

Use the skill to verify and correct common IAM-related errors, enhancing security and compliance in AWS environments.

How to install AWS IAM

View source

1. Install with the skills CLI

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

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by aws

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 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 if the user needs to generate least-privilege IAM policies, determine required IAM actions for API calls, or understand action-to-operation mappings. CRITICAL: If the user provides source code (Python, Go, TypeScript, JavaScript, Java), 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.

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:

    {
      "Version": "2012-10-17",
      "Statement": {
        "Effect": "Allow",
        "Action": "ec2:RunInstances",
        "Resource": "*",
        "Condition": {
          "ForAllValues:StringEquals": {
            "aws:TagKeys": ["Alpha", "Beta"]
          },
          "Null": {
            "aws:TagKeys": "false"
          }
        }
      }
    }
    
  • 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.

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").

Frequently asked questions about AWS IAM

Similar skills