This repository contains the AWS Lambda function demonstrated in the CloudOps Studio tutorial:
Automating EBS Snapshot Cleanup with AWS Lambda
The function scans EBS snapshots in the account and deletes snapshots that match specific tags.
Snapshots are deleted only if they contain the following tags:
AutoDelete = True
Type = Orphan
This ensures automation only removes snapshots that have been explicitly marked for cleanup.
The Lambda function requires the following permissions:
ec2:DescribeSnapshots
ec2:DeleteSnapshot
See the included iam-policy.json file.
- Identify snapshots that are no longer needed
- Tag them:
AutoDelete = True
Type = Orphan
- Run the Lambda function
The function will scan all snapshots and delete only the tagged orphan snapshots.
Python 3.x
lambda_function.py – Lambda cleanup script
iam-policy.json – Required IAM policy
README.md – Project documentation
This code accompanies the CloudOps Studio video:
Automating EBS Snapshot Cleanup with AWS Lambda
Usman Ul-Haq
Cloud Engineer
LinkedIn: https://linkedin.com/in/usman-ul-haq
GitHub: https://github.com/usmanuh
Part of the CloudOps Studio AWS Automation Series