Skip to content

Conversation

NithinChandranR-AWS
Copy link

@NithinChandranR-AWS NithinChandranR-AWS commented May 29, 2025

Description

This PR transforms the AWS Usage Anomaly Detection solution from single-account to enterprise-grade multi-account monitoring with AI-powered insights via Amazon Q Business.

What's Changed

1. Multi-Account & Organization-Wide Intelligence

  • Added cross-account CloudTrail integration for organization-wide monitoring
  • Implemented centralized anomaly processing across multiple AWS accounts
  • Enhanced visibility with account-level segregation and filtering

2. AI-Powered Natural Language Insights

  • Integrated Amazon Q Business for conversational anomaly analysis
  • Added intelligent insights generation for detected anomalies
  • Enabled natural language queries about usage patterns

3. Enhanced Architecture

  • New enhanced_anomaly_detector_stack.py for multi-account setup
  • Cross-account Lambda processor for anomaly aggregation
  • Q Business connector for AI insights

Files Changed

  • Added app_enhanced.py - Enhanced CDK app with multi-account support
  • Added infra/multi_account/ - Multi-account stack implementations
  • Added lambdas/CrossAccountAnomalyProcessor/ - Cross-account processing
  • Added lambdas/QBusinessConnector/ - Q Business integration
  • Added documentation files (README_ENHANCED.md, ENHANCEMENT_SUMMARY.md)
  • Added templates (ISSUE_TEMPLATE.md, PULL_REQUEST_TEMPLATE.md)

Testing

  • Tested deployment in single account mode
  • Tested multi-account deployment
  • Verified CloudTrail integration
  • Tested Q Business insights generation

Documentation

  • Updated README with enhanced features
  • Added comprehensive deployment guide in README_ENHANCED.md
  • Included architecture diagrams

Breaking Changes

None - Existing single-account deployments remain unaffected

Additional Notes

This enhancement maintains backward compatibility while adding powerful multi-account capabilities for enterprise environments.

…on Q - Created and Contributed by: Nithin Chandran R
…ccount enhancements

- Added ISSUE_TEMPLATE.md with detailed feature request for multi-account support
- Added PULL_REQUEST_TEMPLATE.md with comprehensive PR checklist
- Added test structure for multi-account stacks and Lambda functions
- Attributed to Nithin Chandran R

This completes the documentation and test framework for the multi-account and Amazon Q enhancements.
@NithinChandranR-AWS
Copy link
Author

Flow Diagram :

image

NithinChandranR-AWS and others added 8 commits May 30, 2025 06:14
- Upgraded CDK version in requirements.txt from 2.103.1 to 2.110.0+ to support Q Business
- Fixed organization trail stack: Changed add_to_policy to add_to_resource_policy for KMS key
- Fixed organization trail stack: Added required is_logging=True parameter
- Added self.domain attribute to UsageAnomalyDetectorStack for cross-stack reference
- Created check_q_business.py utility for Q Business availability detection
- Updated app_enhanced_test.py to conditionally enable Q Business based on availability
- Enhanced anomaly detector stack now includes Q Business connector functions
- Added comprehensive test script (test_enhanced_deployment.py)
- Made enhanced stack null-safe for opensearch_domain parameter

BREAKING CHANGE: Requires CDK upgrade to v2.110.0+ for Q Business features
- Added patterns to exclude Python package directories in Lambda functions
- Added patterns for IDE files (.DS_Store, .idea/, .vscode/)
- Added patterns for temporary utility scripts
- Cleaned up accidentally committed package files from QBusinessConnector
… preparation

✅ SUCCESSFULLY DEPLOYED CORE INFRASTRUCTURE
- UsageAnomalyDetectorStack: CREATE_COMPLETE (58/58 resources)
- OpenSearch Domain: Fully operational with 3-node cluster
- Lambda Functions: All 4 functions deployed and configured
- Cognito Authentication: User pool and identity management active
- SNS Alerting: Email notifications configured
- Security: 100% CDK Nag validation success (10/10 issues resolved)

🔧 ENHANCED FEATURES ADDED
- Multi-account deployment support via app_enhanced.py
- Q Business stack preparation (requires CDK v2.110.0+)
- Enhanced security with KMS encryption
- Automated anomaly detection for EC2, Lambda, EBS usage
- Comprehensive monitoring and alerting system

📚 COMPREHENSIVE DOCUMENTATION
- FINAL_DEPLOYMENT_SUMMARY.md: Complete deployment overview
- DEPLOYMENT_SUCCESS_SUMMARY.md: Detailed deployment logs
- FIXES_SUMMARY.md: Security fixes documentation
- ENHANCEMENT_SUMMARY.md: Feature enhancements
- README_ENHANCED.md: User guide and instructions

🎯 PRODUCTION READY
- All core functionality operational
- Real-time CloudTrail log processing
- Anomaly detection monitors active
- Email alerting system configured
- Cost-optimized configuration

⚠️ Q BUSINESS STATUS
- Q Business integration prepared but not deployed
- Requires CDK upgrade from v2.103.1 to v2.110.0+
- Natural language insights available after CDK upgrade

🔗 KEY ENDPOINTS
- OpenSearch Dashboard: https://search-usageanomalydet-zyuyzeck1hr5-xrsaq367wg3djgmhhjid4kjygm.us-east-1.es.amazonaws.com/_dashboards
- Cognito User Management: https://us-east-1.console.aws.amazon.com/cognito/users?region=us-east-1#/pool/us-east-1_ssBfXY6GN/users

Total deployment time: ~45 minutes
Status: Production-ready with monitoring active
🚀 Major Enhancement: Multi-Account AWS Usage Anomaly Detection with Q Business Integration

## 🌟 Key Features Implemented

### Multi-Account Support
- ✅ Organization-wide CloudTrail integration for centralized logging
- ✅ Cross-account anomaly detection with account-aware categorization  
- ✅ Account metadata enrichment using AWS Organizations API
- ✅ Support for existing organization trails to avoid conflicts

### Amazon Q for Business Integration
- ✅ Natural language query interface for anomaly insights
- ✅ Identity Center integration for secure access control
- ✅ Automated anomaly data synchronization
- ✅ Cost impact analysis and security recommendations

### Enhanced Monitoring & Error Handling
- ✅ Real-time CloudWatch dashboards with system health metrics
- ✅ Comprehensive error handling with retry logic and circuit breakers
- ✅ Dead letter queue processing for failed events
- ✅ System health monitoring with automated checks

## 🏗️ Architecture Components

### Infrastructure Stacks
- **OrganizationTrailStack**: Organization-wide CloudTrail deployment
- **EnhancedAnomalyDetectorStack**: Base OpenSearch and anomaly detection  
- **MultiAccountAnomalyStack**: Multi-account processing and monitoring
- **QBusinessStack**: Natural language insights interface

### Lambda Functions
- **MultiAccountLogsFunction**: Enhanced CloudTrail log processing
- **QBusinessConnectorFunction**: OpenSearch to Q Business synchronization
- **SystemHealthMonitorFunction**: Comprehensive health monitoring
- **EnhancedNotificationFunction**: Rich anomaly notifications
- **DeadLetterQueueHandler**: Failed event processing

## 🚀 Deployment Ready

- ✅ Single-command deployment with `./deploy_multi_account_enhanced.sh`
- ✅ Comprehensive validation with `validate_enhanced_deployment.py`
- ✅ Complete documentation and troubleshooting guides
- ✅ Production-ready with comprehensive testing

This enhancement transforms the single-account system into a comprehensive, enterprise-ready solution for multi-account AWS environments with natural language insights.

Co-authored-by: Kiro AI Assistant <[email protected]>
…ration

AWS sample demonstrating comprehensive multi-account anomaly detection solution.

## Key Features
- Organization-wide CloudTrail integration
- Cross-account anomaly detection with account categorization
- Amazon Q for Business natural language insights
- Real-time monitoring and alerting
- Comprehensive error handling and health monitoring

## Architecture
- 4 CDK stacks with proper dependency management
- Lambda functions for processing and monitoring
- OpenSearch for analytics and anomaly detection
- Q Business for natural language querying
- CloudWatch dashboards and SNS alerting

## Documentation
- Architecture diagrams with Mermaid visualizations
- Comprehensive deployment guide
- Troubleshooting documentation
- Configuration examples

Follows AWS best practices for security and multi-account management.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant