AgentStack
SKILL verified MIT Self-run

Iam

skill-itsmostafa-aws-agent-skills-iam · by itsmostafa

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.

No reviews yet
0 installs
8 views
0.0% view→install

Install

$ agentstack add skill-itsmostafa-aws-agent-skills-iam

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Iam? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

AWS IAM

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.

Table of Contents

  • [Core Concepts](#core-concepts)
  • [Common Patterns](#common-patterns)
  • [CLI Reference](#cli-reference)
  • [Best Practices](#best-practices)
  • [Troubleshooting](#troubleshooting)
  • [References](#references)

Core Concepts

Principals

Entities that can make requests to AWS: IAM users, roles, federated users, and applications.

Policies

JSON documents defining permissions. Types:

  • Identity-based: Attached to users, groups, or roles
  • Resource-based: Attached to resources (S3 buckets, SQS queues)
  • Permission boundaries: Maximum permissions an identity can have
  • Service control policies (SCPs): Organization-wide limits

Roles

Identities with permissions that can be assumed by trusted entities. No permanent credentials—uses temporary security tokens.

Trust Relationships

Define which principals can assume a role. Configured via the role's trust policy.

Common Patterns

Create a Service Role for Lambda

AWS CLI:

# Create the trust policy
cat > trust-policy.json  policy.json  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

CLI Reference

Essential Commands

| 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 |

Useful Flags

  • --query: Filter output with JMESPath
  • --output table: Human-readable output
  • --no-cli-pager: Disable pager for scripting

Best Practices

Security

  • Never use root account for daily tasks
  • Enable MFA for all human users
  • Use roles instead of long-term access keys
  • Apply least privilege — grant only required permissions
  • Use conditions to restrict access by IP, time, or MFA
  • Rotate credentials regularly
  • Use permission boundaries for delegated administration

Policy Design

  • Start with AWS managed policies, customize as needed
  • Use policy variables (${aws:username}) for dynamic policies
  • Prefer explicit denies for sensitive actions
  • Group related permissions logically

Monitoring

  • Enable CloudTrail for API auditing
  • Use IAM Access Analyzer to identify overly permissive policies
  • Review credential reports regularly
  • Set up alerts for root account usage

Troubleshooting

Access Denied Errors

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:

``bash 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/MyTable ``

  1. Check for explicit denies in SCPs or permission boundaries
  2. Verify resource-based policies allow the principal

Role Cannot Be Assumed

Symptom: AccessDenied when calling AssumeRole

Causes:

  • Trust policy doesn't include the calling principal
  • Missing sts:AssumeRole permission on the caller
  • ExternalId mismatch (for cross-account roles)
  • Session duration exceeds maximum

Fix: Review and update the role's trust relationship.

Policy Size Limits

  • Managed policy: 6,144 characters
  • Inline policy: 2,048 characters (user), 10,240 characters (role/group)
  • Trust policy: 2,048 characters

Solution: Use multiple policies, reference resources by prefix/wildcard, or use tags-based access control.

References

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.