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

Risk and Scope

Detail
Value

Risk Level

Low

AWS Service Targeted

Amazon EBS

Permissions Required

Optimization Policies Addressed

This runbook to remediate violation tickets triggered by of the following policy:

Policy ID
Policy Name

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

How to Install

Refer to the Runbook Setup Guide for steps to install and enable this runbook in your environment.

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.

  1. BranchOnValidSnapshot

    Verifies if each snapshot state is completed.

    1. DeleteSnapshot Executes DeleteSnapshot for snapshots that qualify for deletion.

    2. RunScript

      Raises a runtime error to capture errors, failing the workflow explicitly.

  2. 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

Follow the steps described in the executing a runbook section to apply this runbook to the ticket.

Last updated