RightSizer is a serverless AWS FinOps solution that automatically discovers Amazon EC2 instances, analyzes historical utilization using Amazon CloudWatch metrics, generates intelligent rightsizing recommendations, estimates potential cost savings, stores reports in Amazon S3, and sends email notifications using Amazon SNS. The complete workflow is automated using Amazon EventBridge and AWS Lambda, enabling continuous infrastructure monitoring and cost optimization.
- Automated discovery of running Amazon EC2 instances
- Historical CloudWatch metrics analysis (Last 7 Days)
- CPU, Memory, and Disk utilization monitoring
- Intelligent rightsizing recommendation engine
- Monthly and annual cost savings estimation
- JSON report generation
- Automatic report storage in Amazon S3
- Email notifications using Amazon SNS
- Scheduled execution using Amazon EventBridge
- CloudWatch logging and monitoring
- Fully serverless architecture
- Modular Python implementation
| Service | Purpose |
|---|---|
| Amazon EC2 | Discover and analyze running EC2 instances |
| Amazon CloudWatch | Collect historical utilization metrics |
| CloudWatch Agent | Publish Memory and Disk utilization metrics |
| AWS Lambda | Execute the complete rightsizing workflow |
| Amazon EventBridge | Automatically trigger Lambda on schedule |
| Amazon S3 | Store generated reports |
| Amazon SNS | Send email notifications |
| AWS IAM | Secure access and permissions |
Amazon EventBridge
(Scheduled Trigger)
│
▼
AWS Lambda Function
│
▼
Discover Running EC2 Instances
│
▼
Retrieve Historical CloudWatch Metrics
CPU • Memory • Disk (7 Days)
│
▼
Generate Rightsizing Recommendation
│
▼
Estimate Monthly & Annual Savings
│
┌──────────┴──────────┐
▼ ▼
Generate JSON Report Send SNS Email
│
▼
Upload Report to Amazon S3
│
▼
Execution Completed
RightSizer/
│
├── lambda/
│ ├── lambda_function.py
│ ├── config.py
│ ├── ec2_service.py
│ ├── cloudwatch_service.py
│ ├── recommendation_engine.py
│ ├── pricing.py
│ ├── cost_analyser.py
│ ├── report_generator.py
│ ├── s3_service.py
│ ├── sns_service.py
│ └── requirements.txt
│
├── architecture/
│ └── architecture-diagram.jpeg
│
├── screenshots/
│
├── README.md
└── .gitignore
| Module | Description |
|---|---|
| lambda_function.py | Coordinates the complete serverless workflow |
| config.py | Stores configuration values and thresholds |
| ec2_service.py | Discovers running EC2 instances |
| cloudwatch_service.py | Retrieves historical CloudWatch metrics |
| recommendation_engine.py | Generates rightsizing recommendations |
| pricing.py | Stores EC2 pricing information |
| cost_analyser.py | Calculates monthly and annual savings |
| report_generator.py | Generates JSON reports |
| s3_service.py | Uploads reports to Amazon S3 |
| sns_service.py | Sends summary email notifications |
The recommendation engine analyzes the average CPU utilization over the previous seven days.
| Average CPU Utilization | Recommendation |
|---|---|
| Less than 10% | Stop Idle Instance |
| 10% – 30% | Downsize Instance |
| 30% – 70% | Keep Current Instance |
| Above 70% | Investigate High Utilization |
Memory and Disk utilization are also included in the report for additional operational insights.
The project estimates infrastructure savings using predefined monthly pricing for supported EC2 instance types.
| Recommendation | Estimated Savings |
|---|---|
| Stop Idle Instance | 100% Monthly Cost |
| Downsize Instance | Approximately 50% Monthly Cost |
| Keep Current Instance | No Savings |
| Investigate High Utilization | No Savings |
Both monthly and annual savings are included in the generated report.
| Metric | Source | Used |
|---|---|---|
| CPU Utilization | Amazon CloudWatch | Recommendation Engine |
| Memory Utilization | CloudWatch Agent | Reporting |
| Disk Utilization | CloudWatch Agent | Reporting |
- Launch an Amazon EC2 instance.
- Attach an IAM role with CloudWatch permissions.
- Install and configure the Amazon CloudWatch Agent.
- Verify CPU, Memory, and Disk metrics in Amazon CloudWatch.
- Create an Amazon S3 bucket.
- Create an Amazon SNS topic and subscribe an email endpoint.
- Create an AWS Lambda function.
- Upload all project source files.
- Configure Lambda environment variables.
- Create an EventBridge scheduled rule.
- Test the Lambda function.
- Verify reports in Amazon S3 and notifications through Amazon SNS.
| Variable | Description |
|---|---|
| BUCKET_NAME | Amazon S3 bucket name |
| SNS_TOPIC_ARN | Amazon SNS Topic ARN |
- AWS Pricing API integration
- Historical trend analysis
- CSV and PDF report generation
- Interactive dashboard for report visualization
- DynamoDB integration
- Multi-region monitoring
- Automatic EC2 rightsizing using AWS Systems Manager
- Machine learning-based recommendation engine
- Python
- AWS Lambda
- Amazon EC2
- Amazon CloudWatch
- CloudWatch Agent
- Amazon EventBridge
- Amazon S3
- Amazon SNS
- AWS IAM
- Boto3
During the development of RightSizer, several practical challenges were encountered and resolved:
- Configuring the Amazon CloudWatch Agent for Memory and Disk metrics
- Managing IAM permissions for secure access across AWS services
- Debugging Lambda import and runtime errors
- Handling CloudWatch metric availability and delays
- Configuring EventBridge scheduled execution
- Managing Lambda environment variables
- Designing a modular serverless architecture
Resolving these issues provided practical experience with AWS serverless development, cloud monitoring, debugging distributed systems, and FinOps-based infrastructure optimization.
This project provided practical experience with:
- AWS Lambda
- Amazon EC2
- Amazon CloudWatch
- CloudWatch Agent
- Amazon EventBridge
- Amazon SNS
- Amazon S3
- AWS IAM
- Serverless Architecture
- Infrastructure Automation
- Cloud Monitoring
- FinOps
- AWS SDK for Python (Boto3)
Kishika Singh






