https://github.com/shivam-goswami5123/aws-costoptimzationproject
This project aims to design and implement a serverless solution for automating the management of AWS EBS snapshots.The project leverages AWS services to create a cost-efficient and scalable solution, enabling teams to focus on more critical tasks while reducing cloud infrastructure costs.
https://github.com/shivam-goswami5123/aws-costoptimzationproject
aws aws-cloudwatch aws-lambda-python boto3 cost-optimization event-driven python
Last synced: 7 months ago
JSON representation
This project aims to design and implement a serverless solution for automating the management of AWS EBS snapshots.The project leverages AWS services to create a cost-efficient and scalable solution, enabling teams to focus on more critical tasks while reducing cloud infrastructure costs.
- Host: GitHub
- URL: https://github.com/shivam-goswami5123/aws-costoptimzationproject
- Owner: shivam-goswami5123
- Created: 2024-12-16T05:57:00.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-01-13T14:19:33.000Z (9 months ago)
- Last Synced: 2025-01-22T20:15:42.100Z (9 months ago)
- Topics: aws, aws-cloudwatch, aws-lambda-python, boto3, cost-optimization, event-driven, python
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ AWS Cost ๐ฐOptimization Project
## Problem Statement
**"Automated Cost Optimization of AWS EBS Snapshots"**
In cloud environments, managing storage resources efficiently is crucial to minimizing costs. AWS Elastic Block Store (EBS) snapshots, while essential for backups and disaster recovery, can accumulate over time and result in significant unnecessary expenses if not monitored and managed properly.
Unused snapshots, or snapshots associated with deleted volumes or unused resources, contribute to this cost overhead. Additionally, identifying and removing such snapshots manually can be time-consuming and error-prone, especially in environments with numerous snapshots.
This project aims to design and implement a **serverless solution** for automating the management of AWS EBS snapshots.
The solution will:
1. Identify stale snapshots that are either:
- Not attached to any volume.
- Associated with volumes that are not attached to any running EC2 instance.
2. Check if the snapshot was created more than **10 minutes ago** to ensure recent backups are retained.
3. Automatically delete such snapshots or provide notifications for further action.The project leverages **AWS services** to create a cost-efficient and scalable solution, enabling teams to focus on more critical tasks while reducing cloud infrastructure costs.
---
## Tools and Services Used
### 1. **AWS Lambda** ๐ฅ๏ธ
- Executes the Python script to automate snapshot checks and deletions.
- Serverless execution reduces the need for provisioning resources.### 2. **Amazon CloudWatch** ๐
- Monitors the execution of the Lambda function and generates logs for debugging and tracking.### 3. **AWS EventBridge** ๐
- Schedules periodic triggers for the Lambda function, ensuring automation.### 4. **Python (boto3 Library)** ๐
- The `boto3` library interacts with AWS services (EC2, snapshots, volumes).
- Implements logic to identify stale snapshots based on conditions (e.g., snapshot age, volume state).---
## Implementation Steps
The detailed step-by-step implementation of this project is provided in my **Hashnode blog article**, complete with:
- Code snippets.
- Proper explanations of each step.๐ **Read the full article here**: [Automated Cost Optimization of AWS EBS Snapshots](https://shivamgoswami5123.hashnode.dev/aws-cost-optimization)
---
## Key Features
- **Automation**: Eliminates the need for manual monitoring of snapshots.
- **Cost Efficiency**: Removes unnecessary EBS snapshots, saving cloud storage costs.
- **Customizable**: Flexible conditions for snapshot deletion can be tailored to specific needs.
- **Scalable**: Designed to work seamlessly in large-scale AWS environments.---
## Project Outcomes
By completing this project, you will:
1. Gain hands-on experience with AWS services like Lambda, CloudWatch, and EventBridge.
2. Learn how to use Python's `boto3` library for automating AWS resource management.
3. Understand practical strategies for cloud cost optimization.---
## Future Enhancements
- **Email Notifications**: Add Amazon SNS to notify users about stale snapshots before deletion.
- **Tag-based Filtering**: Retain snapshots based on specific tags (e.g., "critical").
- **Extended Analysis**: Include insights into other cost-saving opportunities like unused EC2 instances or idle load balancers.---