api-gateway
AWS API Gateway for REST and HTTP API management. Use when creating APIs, configuring integrations, setting up authorization,…
AWS Identity and Access Management for users, roles, policies, and permissions. Use when creating IAM policies, configuring cross-account access, setting up service roles, troubleshooting permission errors, or managing access control.
Claude Code
$ npx -y skills add itsmostafa/aws-agent-skills --skill iam --agent claude-code
Codex
$ npx skills add itsmostafa/aws-agent-skills --skill iam -a codex -y
Cursor
$ npx skills add itsmostafa/aws-agent-skills --skill iam -a cursor -y
Gemini CLI
$ npx skills add itsmostafa/aws-agent-skills --skill iam -a gemini-cli -y
GitHub Copilot
$ npx skills add itsmostafa/aws-agent-skills --skill iam -a github-copilot -y
OpenCode
$ npx skills add itsmostafa/aws-agent-skills --skill iam -a opencode -y
Windsurf
$ npx skills add itsmostafa/aws-agent-skills --skill iam -a windsurf -y
name: iam description: AWS Identity and Access Management for users, roles, policies, and permissions. Use when creating IAM policies, configuring cross-account access, setting up service roles, troubleshooting permission errors, or managing access control. last_updated: "2026-01-07" doc_source: https://docs.aws.amazon.com/IAM/latest/UserGuide/
AWS Identity and Access Management (IAM) enables secure access control to AWS services and resources. IAM is foundational to AWS security—every AWS API call is authenticated and authorized through IAM.
Entities that can make requests to AWS: IAM users, roles, federated users, and applications.
JSON documents defining permissions. Types:
Identities with permissions that can be assumed by trusted entities. No permanent credentials—uses temporary security tokens.
Define which principals can assume a role. Configured via the role's trust policy.
**AWS CLI:**
# Create the trust policy
cat > trust-policy.json << 'EOF'
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "Service": "lambda.amazonaws.com" },
"Action": "sts:AssumeRole"
}
]
}
EOF
# Create the role
aws iam create-role \
--role-name MyLambdaRole \
--assume-role-policy-document file://trust-policy.json
# Attach a managed policy
aws iam attach-role-policy \
--role-name MyLambdaRole \
--policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole**boto3:**
import boto3
import json
iam = boto3.client('iam')
trust_policy = {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {"Service": "lambda.amazonaws.com"},
"Action": "sts:AssumeRole"
}
]
}
# Create role
iam.create_role(
RoleName='MyLambdaRole',
AssumeRolePolicyDocument=json.dumps(trust_policy)
)
# Attach managed policy
iam.attach_role_policy(
RoleName='MyLambdaRole',
PolicyArn='arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
)cat > policy.json << 'EOF'
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"dynamodb:GetItem",
"dynamodb:PutItem",
"dynamodb:Query"
],
"Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/MyTable"
}
]
}
EOF
aws iam create-policy \
--policy-name MyDynamoDBPolicy \
--policy-document file://policy.json# In Account B (trusted account), create role with trust for Account A
cat > cross-account-trust.json << 'EOF'
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::111111111111:root" },
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": { "sts:ExternalId": "unique-external-id" }
}
}
]
}
EOF
# From Account A, assume the role
aws sts assume-role \
--role-arn arn:aws:iam::222222222222:role/CrossAccountRole \
--role-session-name MySession \
--external-id unique-external-id| Command | Description | |---------|-------------| | `aws iam create-role` | Create a new IAM role | | `aws iam create-policy` | Create a customer managed policy | | `aws iam attach-role-policy` | Attach a managed policy to a role | | `aws iam put-role-policy` | Add an inline policy to a role | | `aws iam get-role` | Get role details | | `aws iam list-roles` | List all roles | | `aws iam simulate-principal-policy` | Test policy permissions | | `aws sts assume-role` | Assume a role and get temporary credentials | | `aws sts get-caller-identity` | Get current identity |
**Symptom:** `AccessDeniedException` or `UnauthorizedAccess`
**Debug steps:** 1. Verify identity: `aws sts get-caller-identity` 2. Check attached policies: `aws iam list-attached-role-policies --role-name MyRole` 3. Simulate the action:
aws iam simulate-principal-policy \
--policy-source-arn arn:aws:iam::123456789012:role/MyRole \
--action-names dynamodb:GetItem \
--resource-arns arn:aws:dynamodb:us-east-1:123456789012:table/MyTable4. Check for explicit denies in SCPs or permission boundaries 5. Verify resource-based policies allow
Supercharge Claude Code with AWS cloud engineering skills across 18 core AWS services.
AWS API Gateway for REST and HTTP API management. Use when creating APIs, configuring integrations, setting up authorization,…
AWS Bedrock foundation models for generative AI. Use when invoking foundation models, building AI applications, creating…
AWS CloudFormation infrastructure as code for stack management. Use when writing templates, deploying stacks, managing drift,…
AWS CloudWatch monitoring for logs, metrics, alarms, and dashboards. Use when setting up monitoring, creating alarms, querying…
AWS Cognito user authentication and authorization service. Use when setting up user pools, configuring identity pools,…
AWS DynamoDB NoSQL database for scalable data storage. Use when designing table schemas, writing queries, configuring indexes,…
Use when running, building, or managing Linux containers on macOS, or when a task involves Docker, docker compose, Lima, Colima,…
Operate FrontendExtension (FE) resources in frontend-forge: create, update, rebuild, inspect package artifacts, download…
Entry point for AI-agent work on AWS: pick a runtime, plan a migration for existing workloads, and build an executable POC — one…
Build, debug, or review Cloudflare Agents SDK applications using the agents package.