aws-iam-analysis
IAM security review, access analysis, and compliance assessment for AWS accounts.
- License 许可
- GPL-3.0
- 最近更新
- 2026-10-21
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- aws-iam-analysis
- description
- IAM security review, access analysis, and compliance assessment for AWS accounts.
03 SKILL.md 正文
AWS IAM Analysis Skill
Status: ACTIVE
Mode: security-review, cloud-architect, compliance-reviewer
MCP Server: aws-iam
Last Updated: 2026-05-22
Overview
This skill provides a structured runbook for analyzing AWS IAM policies, roles, and permissions using the AWS IAM MCP server. It covers policy inspection, permission simulation, access key auditing, and security posture assessment.
Use this skill when:
- Auditing IAM policies for security compliance
- Analyzing role permissions and trust relationships
- Simulating policy effects before deployment
- Investigating access key usage and rotation
- Assessing MFA device configuration
- Reviewing cross-account access patterns
Prerequisites
- AWS Credentials:
AWS_PROFILEandAWS_REGIONenvironment variables configured - IAM Permissions: User/role must have
iam:Get*andiam:List*permissions (read-only) - MCP Server:
aws-iamupstream active inmcp-proxy - Tool Access: Verify tools available via
mcp_search("iam")
Core Workflows
Workflow 1: Inventory IAM Resources
Goal: Discover and catalog all IAM users, groups, and roles in the account.
Steps:
-
List all IAM users:
mcp_call(ref="t:aws-iam.list_users", args={})Returns: User names, ARNs, creation dates, password last used
-
List all IAM groups:
mcp_call(ref="t:aws-iam.list_groups", args={})Returns: Group names, ARNs, creation dates
-
List all IAM roles:
mcp_call(ref="t:aws-iam.list_roles", args={})Returns: Role names, ARNs, creation dates, assume role policy
Decision Tree:
- If auditing user access → Proceed to Workflow 2 (inspect user policies)
- If auditing service roles → Proceed to Workflow 3 (inspect role trust policies)
- If auditing group membership → Proceed to Workflow 4 (inspect group policies)
Workflow 2: Inspect User Permissions
Goal: Analyze what permissions a specific IAM user has.
Steps:
-
Get user details:
mcp_call(ref="t:aws-iam.get_user", args={ "user_name": "alice" })Returns: User ARN, creation date, password last used, MFA devices
-
List inline policies attached to user:
mcp_call(ref="t:aws-iam.list_user_policies", args={ "user_name": "alice" })Returns: Policy names (inline policies only)
-
Get inline policy document:
mcp_call(ref="t:aws-iam.get_user_policy", args={ "user_name": "alice", "policy_name": "inline-policy-name" })Returns: Policy document (JSON)
-
List managed policies attached to user:
mcp_call(ref="t:aws-iam.list_attached_user_policies", args={ "user_name": "alice" })Returns: Managed policy names and ARNs
-
Get managed policy details:
mcp_call(ref="t:aws-iam.get_policy", args={ "policy_arn": "arn:aws:iam::ACCOUNT:policy/my-policy" })Returns: Policy metadata (creation date, update date, attachment count)
-
Get policy version (actual permissions):
mcp_call(ref="t:aws-iam.get_policy_version", args={ "policy_arn": "arn:aws:iam::ACCOUNT:policy/my-policy", "version_id": "v2" })Returns: Policy document (JSON) with statements
Decision Tree:
- If user has excessive permissions → Flag for remediation
- If user lacks required permissions → Recommend policy attachment
- If user has old policies → Check for deprecation and cleanup
Workflow 3: Inspect Role Trust Relationships
Goal: Analyze which principals can assume a specific IAM role.
Steps:
-
Get role details:
mcp_call(ref="t:aws-iam.get_role", args={ "role_name": "lambda-execution-role" })Returns: Role ARN, creation date, max session duration
-
Get role trust policy (assume role policy):
mcp_call(ref="t:aws-iam.get_role_trust_policy", args={ "role_name": "lambda-execution-role" })Returns: Trust policy document (JSON) showing who can assume the role
-
List inline policies attached to role:
mcp_call(ref="t:aws-iam.list_role_policies", args={ "role_name": "lambda-execution-role" })Returns: Inline policy names
-
Get inline policy document:
mcp_call(ref="t:aws-iam.get_role_policy", args={ "role_name": "lambda-execution-role", "policy_name": "inline-policy-name" })Returns: Policy document (JSON)
-
List managed policies attached to role:
mcp_call(ref="t:aws-iam.list_attached_role_policies", args={ "role_name": "lambda-execution-role" })Returns: Managed policy names and ARNs
Decision Tree:
- If trust policy allows broad principals (e.g.,
"Principal": "*") → Flag as security risk - If trust policy is overly restrictive → May block legitimate service usage
- If role has excessive permissions → Recommend least-privilege policy
Workflow 4: Inspect Group Permissions
Goal: Analyze what permissions a specific IAM group has.
Steps:
-
Get group details:
mcp_call(ref="t:aws-iam.get_group", args={ "group_name": "developers" })Returns: Group ARN, creation date, member count
-
List inline policies attached to group:
mcp_call(ref="t:aws-iam.list_group_policies", args={ "group_name": "developers" })Returns: Inline policy names
-
Get inline policy document:
mcp_call(ref="t:aws-iam.get_group_policy", args={ "group_name": "developers", "policy_name": "inline-policy-name" })Returns: Policy document (JSON)
-
List managed policies attached to group:
mcp_call(ref="t:aws-iam.list_attached_group_policies", args={ "group_name": "developers" })Returns: Managed policy names and ARNs
Decision Tree:
- If group has excessive permissions → Recommend least-privilege policy
- If group is empty → Consider removing unused group
- If group members need different permissions → Split into multiple groups
Workflow 5: Simulate Policy Effects
Goal: Test what actions a principal can perform without making actual API calls.
Steps:
-
Simulate principal policy (user/role with attached policies):
mcp_call(ref="t:aws-iam.simulate_principal_policy", args={ "policy_source_arn": "arn:aws:iam::ACCOUNT:user/alice", "action_names": ["s3:GetObject", "s3:PutObject", "ec2:DescribeInstances"], "resource_arns": ["arn:aws:s3:::my-bucket/*", "arn:aws:ec2:*:ACCOUNT:instance/*"] })Returns: Evaluation results (allowed/denied) for each action
-
Simulate custom policy (test policy before attaching):
mcp_call(ref="t:aws-iam.simulate_custom_policy", args={ "policy_input_list": [ { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "s3:*", "Resource": "*" } ] } ], "action_names": ["s3:GetObject", "s3:DeleteBucket"], "resource_arns": ["arn:aws:s3:::my-bucket/*"] })Returns: Evaluation results for each action
Decision Tree:
- If action is denied → Check policy for explicit deny or missing allow
- If action is allowed → Verify it's intentional (least-privilege check)
- If simulating new policy → Test before attaching to production roles
Workflow 6: Audit Access Keys
Goal: Inventory and audit IAM access keys for rotation and usage.
Steps:
-
List access keys for a user:
mcp_call(ref="t:aws-iam.list_access_keys", args={ "user_name": "alice" })Returns: Access key IDs, creation dates, status (active/inactive)
-
Get access key last used:
mcp_call(ref="t:aws-iam.get_access_key_last_used", args={ "access_key_id": "AKIAIOSFODNN7EXAMPLE" })Returns: Last used timestamp, service name, region
Decision Tree:
- If access key not used in 90 days → Recommend deactivation/deletion
- If access key is old (>1 year) → Recommend rotation
- If access key is inactive → Safe to delete
Workflow 7: Audit MFA Configuration
Goal: Verify MFA device configuration for users and roles.
Steps:
-
List MFA devices for a user:
mcp_call(ref="t:aws-iam.list_mfa_devices", args={ "user_name": "alice" })Returns: MFA device serial numbers, enable dates
-
List all virtual MFA devices in account:
mcp_call(ref="t:aws-iam.list_virtual_mfa_devices", args={})Returns: Virtual MFA device serial numbers, user associations
Decision Tree:
- If user lacks MFA → Flag for compliance violation
- If MFA device is orphaned (no user) → Recommend deletion
- If MFA device is old → Verify it's still in use
Security Analysis Patterns
Pattern 1: Overly Permissive Policies
Indicators:
- Policies with
"Action": "*"and"Resource": "*" - Policies with
"Effect": "Allow"and no conditions - Roles with
AdministratorAccessattached
Remediation:
- Use
simulate_principal_policyto identify actual required actions - Create least-privilege policy with specific actions and resources
- Add conditions (IP restrictions, time-based, MFA requirement)
Pattern 2: Unused Access Keys
Indicators:
- Access keys not used in 90+ days
- Access keys created but never used
- Multiple active access keys per user
Remediation:
- Use
get_access_key_last_usedto identify unused keys - Deactivate unused keys (don't delete immediately)
- Delete after 30-day grace period
Pattern 3: Missing MFA
Indicators:
- Users without MFA devices
- Console access without MFA requirement
- Privileged roles without MFA
Remediation:
- Use
list_mfa_devicesto audit MFA coverage - Enforce MFA via policy condition:
"Condition": {"Bool": {"aws:MultiFactorAuthPresent": "true"}} - Require MFA for sensitive operations (IAM changes, billing)
Pattern 4: Overly Broad Trust Policies
Indicators:
- Trust policy with
"Principal": "*" - Trust policy allowing cross-account access without conditions
- Service roles with unnecessary principals
Remediation:
- Use
get_role_trust_policyto audit trust relationships - Restrict principal to specific AWS account or service
- Add conditions (source IP, external ID for cross-account)
Troubleshooting
Issue: Access denied on IAM operations
Cause: User/role lacks iam:Get* or iam:List* permissions
Resolution:
- Verify IAM role has read-only IAM permissions
- Check if policy explicitly denies IAM actions
- Use
simulate_principal_policyto test permissions
Issue: Policy simulation returns unexpected results
Cause: Policy conditions not evaluated correctly
Resolution:
- Verify policy syntax is valid JSON
- Check for explicit deny statements (deny overrides allow)
- Test with simplified policy first
Issue: Access key last used shows no data
Cause: Access key never used or data not yet available
Resolution:
- Wait 24 hours for CloudTrail data to populate
- Verify access key is active (not inactive)
- Check if access key was used in a different region
Integration with Other Skills
aws-cloudwatch-observability: Use to view CloudTrail logs for IAM API callsaws-lambda-management: Use to inspect Lambda execution role policiesaws-ecs-troubleshooting: Use to inspect ECS task role policies
Compliance Mappings
| Compliance Framework | Relevant Checks |
|---|---|
| CIS AWS Foundations | MFA enabled, access key rotation, root account protection |
| PCI DSS | Least-privilege access, MFA for privileged users, access key rotation |
| HIPAA | Audit logging, access controls, encryption key management |
| SOC 2 | Access reviews, privilege management, audit trails |
References
04 同仓库更多 Skills
ugip
Unified Global Initialization Protocol. Run at the start of every session to initialize GitNexus, flush .ai-memory/ to Qdrant, read ROO_CODE_CONTEXT.md, check the git branch, and run role-specific recall_context queries. Invoke with /ugip.
template-skill
Replace with description of the skill and when Claude should use it.
skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
puppeteer-automation
Comprehensive Puppeteer automation skill for web scraping, browser testing, screenshot generation, form automation, and performance monitoring. Use when tasks involve browser automation, web testing, data extraction, or UI validation.
model-enhancement-mcp
Guide for creating MCP servers that enhance LLM reasoning through structured processes, persistence, and workflow guidance. Use when building MCP servers for structured thinking, journaling, memory systems, or other cognitive enhancement patterns.
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).