How amara200169/aws-cost-optimizer works
AWS Cost Optimizer scans running EC2 instances for low CPU usage, estimates potential savings, and can stop idle instances in explicitly enabled live mode. Users can run the local CLI or view results in the Streamlit dashboard; the scheduled Lambda runs the same workflow and publishes a cost report. Terraform provisions the scheduled AWS deployment and its alerting and failure-handling resources. The runtime scanner and dashboard/handler calls are shown from sampled source; deployment and supporting AWS relationships rely on README documentation.
Main entry points: main.tf Terraform Infrastructure · scanner.py Local Scanner · lambda_handler.py Scheduled Handler · lambda_src/scanner.py Lambda Scanner
Components 24
User Interfaces
- Local CLI
scanner.py - Streamlit Dashboard
dashboard.py - Scheduled Handler
lambda_src/lambda_handler.py
Scan and Remediation
- Local Scanner
scanner.py - Lambda Scanner
lambda_src/scanner.py - Idle Detection
scanner.py - Idle Detection
lambda_src/scanner.py - Cost Summary
scanner.py - Cost Summary
lambda_src/scanner.py - Savings Estimate
scanner.py - Savings Estimate
lambda_src/scanner.py - Remediation
scanner.py - Remediation
lambda_src/scanner.py
AWS Integrations
- EC2
- CloudWatch Metrics
- Cost Explorer
- SNS Alerts
- EventBridge Schedule
- SQS Dead-Letter Queue
- CloudWatch Alarm
Cloud Deployment
- Terraform Infrastructure
main.tf - Terraform State Store
Other components
- Operator
- Email Subscriber
Connections 33
- Operator → Local CLI: runs
README.md - Operator → Streamlit Dashboard: opens
README.md - Local CLI → Local Scanner: runs scan
scanner.py - Streamlit Dashboard → Local Scanner: requests metrics
dashboard.py - Streamlit Dashboard → Remediation: runs live
dashboard.py - Scheduled Handler → Lambda Scanner: calls scan
lambda_src/lambda_handler.py - Local Scanner → Idle Detection: calls
scanner.py - Local Scanner → Cost Summary: calls
scanner.py - Local Scanner → Remediation: calls
scanner.py - Idle Detection → Savings Estimate: estimates savings
scanner.py - Lambda Scanner → Idle Detection: calls
lambda_src/scanner.py - Lambda Scanner → Cost Summary: calls
lambda_src/scanner.py - Lambda Scanner → Remediation: calls
lambda_src/scanner.py - Idle Detection → Savings Estimate: estimates savings
lambda_src/scanner.py - Idle Detection → EC2: lists instances
scanner.py - Idle Detection → CloudWatch Metrics: reads CPU
scanner.py - Cost Summary → Cost Explorer: reads spend
scanner.py - Remediation → EC2: stops instances
scanner.py - Idle Detection → EC2: lists instances
lambda_src/scanner.py - Idle Detection → CloudWatch Metrics: reads CPU
lambda_src/scanner.py - Cost Summary → Cost Explorer: reads spend
lambda_src/scanner.py - Remediation → EC2: stops instances
lambda_src/scanner.py - Scheduled Handler → SNS Alerts: publishes report
lambda_src/lambda_handler.py - SNS Alerts → Email Subscriber: sends alert
README.md - EventBridge Schedule → Scheduled Handler: triggers daily
README.md - Scheduled Handler → SQS Dead-Letter Queue: routes failures
README.md - CloudWatch Alarm → Email Subscriber: emails on errors
README.md - Terraform Infrastructure → EventBridge Schedule: provisions
README.md - Terraform Infrastructure → Scheduled Handler: deploys
README.md - Terraform Infrastructure → SNS Alerts: provisions
README.md - Terraform Infrastructure → SQS Dead-Letter Queue: provisions
README.md - Terraform Infrastructure → CloudWatch Alarm: configures
README.md - Terraform Infrastructure → Terraform State Store: uses backend
README.md