Architecture overview
The IAM agent consists of three main components:- IAM Client (
/internal/iam/client.go) - AWS SDK wrapper for IAM operations - Analyzer SubAgent (
/internal/iam/analyzer/) - Security finding detection - Fixer SubAgent (
/internal/iam/fixer/) - Automated remediation planning
Configuration
The IAM agent uses AWS profiles and supports multiple accounts:Client initialization
Create an IAM agent with profile and region:Security analysis
Analyze account
Perform comprehensive security analysis across all IAM resources:Analyze specific role
Focus analysis on a single IAM role:Analyze specific policy
Security finding types
The analyzer detects multiple security issue types:Severity levels
Security finding structure
Automated remediation
Generate fix plan
Request automated remediation for security findings:Fix plan structure
Apply fix plan
Execute automated remediation (requires confirmation):Supported fix actions
Credential analysis
The IAM agent generates and analyzes AWS credential reports:IAM operations
List roles
Get role details
Update policies
Natural language queries
Use natural language for IAM security analysis:Best practices
Start with read-only analysis
Start with read-only analysis
Always run
analyze commands before attempting fixes. Review findings manually before applying automated remediation.Use scoped queries for targeted analysis
Use scoped queries for targeted analysis
Scope IAM analysis to specific roles or policies using
--role-arn or --policy-arn flags for faster, focused results.Review fix plans before applying
Review fix plans before applying
Automated remediation plans include warnings and notes. Review these carefully, especially for production environments.
Monitor credential reports regularly
Monitor credential reports regularly
Schedule regular credential report analysis to catch credential hygiene issues early:
Leverage conversation history
Leverage conversation history
The IAM agent maintains conversation history per AWS account. Use this for tracking remediation progress over time.
Example workflows
Complete security audit
Role-specific security review
Credential hygiene
Error handling
The IAM agent provides detailed error messages:- Access Denied: IAM client lacks required permissions
- Role Not Found: Specified role ARN doesn’t exist
- Invalid Policy Document: Policy JSON is malformed
- Account Not Accessible: Profile doesn’t have STS permissions