Skip to content

usmanuh/aws-snapshot-cleanup-lambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS Snapshot Cleanup Lambda

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.


Cleanup Logic

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.


Required IAM Permissions

The Lambda function requires the following permissions:

ec2:DescribeSnapshots
ec2:DeleteSnapshot

See the included iam-policy.json file.


Example Workflow

  1. Identify snapshots that are no longer needed
  2. Tag them:

AutoDelete = True
Type = Orphan

  1. Run the Lambda function

The function will scan all snapshots and delete only the tagged orphan snapshots.


Lambda Runtime

Python 3.x


Files Included

lambda_function.py – Lambda cleanup script
iam-policy.json – Required IAM policy
README.md – Project documentation


Video Tutorial

This code accompanies the CloudOps Studio video:

Automating EBS Snapshot Cleanup with AWS Lambda


Author

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

About

AWS Lambda automation to detect and remove orphaned EBS snapshots to reduce AWS storage costs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages