How prahalya05/aws-waste-scanner works
aws-waste-scanner is a scheduled AWS idle-resource auditing job. EventBridge invokes a Lambda that selects registered accounts, scans EC2 inventory across regions, classifies idle resources, estimates their costs, and builds an account-specific report. The report is written to S3 as the authoritative result before optional Gemini narration and Slack notification. A local CLI reuses the scan and report logic without writing to S3 or calling those integrations. The graph reflects README-documented infrastructure and workflow where source excerpts are incomplete; unshown implementation details and calls are omitted.
Main entry points: handler.py Lambda handler · scanner.py Regional scanner · local_run.py Local scan CLI · ai_summary.py Optional AI summary
Components 17
Run orchestration
- Lambda handler
lambda/src/handler.py - Account selection
lambda/src/handler.py - Local scan CLI
scripts/local_run.py
Inventory and analysis
- Regional scanner
lambda/src/scanner.py - Idle resource findings
lambda/src/scanner.py - Cost estimation
lambda/src/pricing.py
Report and delivery
- Report assembly
lambda/src/report.py - Optional AI summary
lambda/src/ai_summary.py - Slack notification
lambda/src/slack.py
AWS and external services
- Daily scheduler
- EC2 inventory API
- Report object store
- Gemini API
- Slack webhook
- Target account role
spoke - CloudWatch Logs
Other components
- Operator
Connections 17
- Daily scheduler → Lambda handler: invokes daily
README.md - Lambda handler → Account selection: selects accounts
lambda/src/handler.py - Lambda handler → Target account role: assumes role
README.md - Lambda handler → Regional scanner: runs scan
lambda/src/handler.py - Local scan CLI → Regional scanner: runs scan
scripts/local_run.py - Local scan CLI → Report assembly: builds report
scripts/local_run.py - Regional scanner → EC2 inventory API: describes resources
lambda/src/scanner.py - Regional scanner → Idle resource findings: identifies waste
lambda/src/scanner.py - Idle resource findings → Cost estimation: estimates costs
lambda/src/scanner.py - Lambda handler → Report assembly: assembles report
lambda/src/handler.py - Lambda handler → Report object store: writes JSON
lambda/src/handler.py - Lambda handler → Optional AI summary: requests summary
lambda/src/handler.py - Optional AI summary → Gemini API: sends prompt
lambda/src/ai_summary.py - Lambda handler → Slack notification: posts report summary
lambda/src/handler.py - Slack notification → Slack webhook: sends notification
README.md - Operator → Local scan CLI: runs locally
scripts/local_run.py - Lambda handler → CloudWatch Logs: writes logs
README.md