Delete unused EBS Volumes
What It Does
Deletes unused EBS volumes that are no longer attached to any EC2 instance. Unused volumes continue to incur storage costs even when idle. This runbook removes orphaned volumes after creating a snapshot for backup, helping reduce storage waste and control spend.
Risk and Scope
Risk Level
Medium
AWS Service Targeted
Elastic Block Store (EBS)
Permissions Required
Delete Permissions
ec2:DeleteVolume
Write Permissions
ec2:CreateSnapshot
Read Permissions
ec2:DescribeVolumes
These permissions are granted only to the runbook, not to the OneLens platform itself.
Optimization Policies Addressed
This runbook remediates violation tickets of the following policy:
ebs_2
EBS volumes should not be unattached
ebs_11
EBS volumes should not be attached to stopped instances for long periods
Risk Mitigation
Risk Mitigation Strategy
Snapshots are taken before the change to prevent any data loss.
The volume can be re-created from that snapshot if needed.
How to Install
Runbook Workflow
Step 1: Start
Trigger: Initiates the workflow to identify and delete orphaned EBS volumes.
Step 2: validateEBS
Action:Runs a validation script to identify whether the EBS volume is unused and safe to delete.
Step 3: If/Else
Condition: Checks whether the volume qualifies for deletion.
If eligible, proceeds with deletion workflow:
CreateSnapshot Creates a snapshot of the EBS volume to retain a backup.
WaitForSnapshotCompletion Ensures snapshot creation is complete by describing snapshot status.
DeleteVolume Deletes the EBS volume to eliminate unnecessary storage cost.
Else:
Ends the workflow if no deletable volume is identified.
See How It Works
Triggering the Runbook
To run this workflow:
1. Locate the Ticket
Identify the ticket associated with the above mentioned policy violation.
2. Execute the Runbook
Last updated