All Collections
Helpful Tips and Pointers
Preserving EBS Snapshots Per EBS Volume
Preserving EBS Snapshots Per EBS Volume

Applying "Minimum to Keep" for each source EBS volume when deleting EBS snapshots

Matt Houser avatar
Written by Matt Houser
Updated over a week ago

When deleting EBS snapshots, Skeddly's "Delete EBS Snapshots" action includes a "Minimum to Keep" field which allows you to specify a minimum number of EBS snapshots to preserve, even if they are older than the desired age.

However, often you want to apply this field to snapshots independently for each source EBS volume.

Option 1: Group by "Volume ID"

EBS snapshots include a Volume ID property which is a reference back to the source EBS volume. Skeddly can use this to differentiate the EBS snapshots based on their source EBS volume when applying "Minimum to Keep" or our "Grandfather-Father-Son" delete scheme.

On the "Delete EBS Snapshots" action, set the following fields:

  • Snapshot Grouping: By Volume ID 

With this option set, the "Minimum to Keep" field will apply to snapshots independently for each EBS volume.

However, this will not work if EBS snapshots are copied (within the same region, or across regions). When an EBS snapshot is copied, the copy's Volume ID  property will be set to vol-ffffffff . It loses the reference to the original volume.

If you are copying EBS snapshots, then you'll want to use Option 2.

Option 2: Group by "Resource Tag"

Skeddly can group EBS snapshots together based on the values of a resource tag. In some cases (like if you are copying EBS snapshots) this may become necessary since the Volume ID  field cannot be used anymore.

When creating the EBS snapshots, add a resource tag that sets the EBS volume's ID. By default, Skeddly's EBS snapshot-creating actions add such a tag: skeddly:volume-id  = $(VOLUMEID) .

By doing this, when the EBS snapshot is copied, the tag can be copied as well and the volume ID preserved.

Step 2: Group by "Resource Tag"

When using the "Delete EBS Snapshots", you can use "Snapshot Grouping" to have Skeddly group the snapshots based on the resource tag volume ID.

On the "Delete EBS Snapshots" action, set the following fields:

  • Snapshot Grouping: By Resource Tag 

  • Grouping Resource Tag Name: skeddly:volume-id 

With this option set, the "Minimum to Keep" field will apply to snapshots independently for each resource tag value, which we've set to be the EBS volume.


Did this answer your question?