The EBS Janitor script automates the detection, backup, and deletion of orphaned EBS volumes in AWS. It helps reduce unnecessary storage costs by ensuring that unattached volumes older than seven days are identified, snapshotted for backup, and then deleted.
- Find Orphaned Volumes: Identifies unattached EBS volumes older than seven days.
- Snapshot Creation: Creates a backup snapshot before deleting volumes.
- Tagging for Compliance: Tags snapshots for tracking.
- Automated Cleanup: Deletes old volumes to free up storage.
- Python 3.x
- Boto3 (AWS SDK for Python)
- AWS CLI configured with appropriate permissions
- Clone the repository or download the script.
- Install required dependencies:
pip install boto3
- Configure AWS credentials:
aws configure
Run the script using:
python ebs_cleanup_script.py
Ensure the following AWS IAM permissions are granted:
ec2:DescribeVolumes
ec2:CreateSnapshot
ec2:DeleteVolume
ec2:CreateTags
- The script will only delete volumes that have been unattached for more than seven days.
- Snapshots created will be tagged for tracking.
This project is licensed under the MIT License.
Feel free to open issues or submit pull requests for improvements!