Delete EBS Snapshots for which corresponding volumes are not in use
What It Does
Deletes Amazon EBS snapshots whose corresponding volumes are no longer in use. These orphaned snapshots can consume unnecessary storage costs.
Recommendation
If you require snapshots but are accessed infrequently, consider archiving them for up to 75% savings.
However, archived snapshots incur a minimum 90-day charge, and restoring them may take up to 72 hours.
Risk and Scope
Risk Level
Low
AWS Service Targeted
Amazon EBS
Permissions Required
Delete Permission
ec2:DeleteSnapshot
Read Permission
ec2:DescribeSnapshots
These permissions are granted only to the runbook, not to the OneLens platform itself.
Optimization Policies Addressed
This runbook to remediate violation tickets triggered by of the following policy:
ebs_100
EBS Snapshots of the deleted volumes should be deleted
ebs_101
EBS Snapshots of unattached EBS volumes should be deleted
ebs_102
EBS Snapshots created while copying AMI should be deleted
Risk Mitigation
Risk Mitigation Strategy
The change is assessed as low risk with limited scope and impact.
No downtime is expected during or after implementation.
No additional safety measures are required due to the non-disruptive nature of the change.
A rollback plan is not defined, as standard procedures are sufficient to manage the change.
How to Install
Runbook Workflow
Step 1: Start
Trigger: Begins the runbook to identify and remove orphaned EBS snapshots.
Step 2: DescribeSnapshots
Action: Calls DescribeSnapshots
to retrieve all EBS snapshots.
Step 3: If/Else
Condition: Checks if any snapshots exist for which the associated EBS volumes no longer exist.
BranchOnValidSnapshot
Verifies if each snapshot state is completed.
DeleteSnapshot Executes
DeleteSnapshot
for snapshots that qualify for deletion.RunScript
Raises a runtime error to capture errors, failing the workflow explicitly.
Else:
The workflow ends if no qualifying snapshots are found.
See How it Works
Triggering the Runbook
To run this runbook:
1. Locate the Ticket
Find the ticket generated by the above policy violation.
2. Execute the Runbook
Last updated