This project focuses on optimizing AWS costs by automating various cost-saving tasks using AWS Lambda functions. The project includes Python scripts for:
- Deleting unused EBS snapshots.
- Identifying and stopping underutilized EC2 instances.
- Releasing unused Elastic IPs.
- Moving old S3 objects to Glacier storage.
- Sending alerts for underutilized resources.
- Automated EBS Snapshot Cleanup: Deletes snapshots that are not associated with active volumes.
- EC2 Optimization: Identifies EC2 instances with CPU utilization below 10% and stops them.
- Elastic IP Cleanup: Releases Elastic IPs that are not associated with running instances.
- S3 Storage Optimization: Moves S3 objects older than 30 days to Glacier storage for cost reduction.
- Alerting Mechanism: Sends notifications via AWS SNS for underutilized EC2 instances.
- AWS Lambda
- Amazon EC2
- Amazon S3
- Amazon CloudWatch
- Amazon SNS
- Amazon Glacier
- Create an AWS Lambda function for each script and upload the corresponding Python file.
- Attach IAM roles with appropriate permissions:
AmazonEC2FullAccessAmazonS3FullAccessCloudWatchReadOnlyAccessAmazonSNSFullAccess
- Set up CloudWatch Event Rules to trigger Lambda functions at regular intervals.
- Configure SNS Topics for alert notifications.
- Test the Lambda functions using sample event payloads.
Deletes EBS snapshots that are not associated with any active volumes.
import boto3
...Finds EC2 instances with CPU utilization below 10% over the past day and stops them.
import boto3
...Releases Elastic IPs that are not in use.
import boto3
...Moves objects older than 30 days to Glacier storage to reduce S3 costs.
import boto3
...By automating these cost-saving tasks, this project helps in optimizing AWS resource usage and reducing unnecessary expenses. Future enhancements could include auto-scaling recommendations and integrating more cost-saving strategies.



