Automated AWS Lambda function that identifies and deletes unused, orphaned, or outdated EBS snapshots to help reduce your AWS bill and keep your infrastructure clean π§Ό.
β Deletes EBS snapshots that are:
- π€ Not attached to any volume
- π Taken from volumes not connected to any running EC2 instance
- ποΈ Linked to deleted volumes
π Logs every action into CloudWatch Logs for traceability
π Uses least privilege IAM role
π§ Written in Python using boto3
π‘ Currently manually triggered from the AWS Lambda Console (EventBridge integration optional)
Service / Tool | Purpose |
---|---|
βοΈ AWS Lambda | Serverless compute environment |
π½ EBS Snapshots | Identified and cleaned up |
π₯οΈ EC2 Instances | Checked for volume attachments |
π IAM Roles | Secure, scoped access permissions |
π¦ boto3 SDK | Python AWS SDK to interact with AWS |
π CloudWatch Logs | Audit + Debugging |
π§βπ» Manual Trigger (via AWS Lambda Console or CLI) | βΌ π§ AWS Lambda Function (Python + boto3 logic) | βΌ π¦ EC2 API Calls: ββ π₯οΈ describe_instances ββ π½ describe_volumes ββ π§Ύ describe_snapshots ββ β delete_snapshot (if conditions met) | βΌ π CloudWatch Logs: ββ π Logs all deletions and errors for audit/debug