The Delete EBS Snapshots action can be used to delete many EBS snapshots based on specific criteria. Possible criteria includes the snapshots name, description, volume id or any of the snapshot's tags.
For example, it can be used to:
- delete all snapshots
- delete all snapsnots older than 7 days
- delete only snapshots that contain "backup" in it's name.
- delete snapshots that contain "backup" in it's name and are older than 5 days
- delete snapshots that have an EC2 tag called "Retention" with value "14-days" and are older than 14 days
The Delete Snapshots action includes a "test mode" as a way of determining which snapshots will be deleted without actually deleting the snapshots. This way, you can fine tune your action without concern for deleting the wrong snapshots. Test Mode is on by default.
When test mode is enabled, execute your action normally then check the action logs to verify that only snapshots that should have been deleted would have been deleted, and that snapshots that should not have been deleted would not have been deleted.
When you are satisfied, disable Test Mode.
Please see Common Action Settings for a description of settings common to all action types.
Snapshot Identification Method
Indicates the method in which snapshots will be selected for possible deletion. Options include:
- All Snapshots
- By Description
- By Name Tag
- Volume ID
- By Resource Tag
Resource Tag Name
Required if "Snapshot Identification Method" is set to "By Resource Tag". Specifies the name of the resource tag to use for comparison when selecting snapshots.
Required if "Snapshot Identification Method" is not set to "All Snapshots". Specifies the comparison to use when selecting snapshots.
Indicates the deletion scheme used to decide if snapshots should be deleted or preserved. Options include:
- Delete All Snapshots - All snapshots selected will be deleted.
- Simple, Oldest First - Older snapshots will be deleted based on age, newer snapshots will be preserved.
- Grandfather-Father-Son - Snapshots will be preserved based on a minimum number of daily, weekly, monthly, and yearly snapshots.
Only snapshots older than the specified number of days will be deleted.
Minimum To Keep
Indicates the minimum number of snapshots to keep. Newer snapshots are favoured to keep over older snapshots.
When enabled, the action group snapshots together and apply delete scheme on each group independently. Possible options include:
- None - No grouping will occur.
- By Volume ID - Snapshots will be grouped based on the volume ID.
- By Resource Tag - Snapshots will be grouped based on the value of a specified resource tag.
Grouping Resource Tag Name
Name of the resource tag to use to group snapshots.
Indicates the method in which the report will be sent.
Indicate the target email address to which the reports will be sent. Possible options include:
Alternate Email Addresses
Indicates the alternate email addresses to which the reports will be sent.
Specify the format of the report. Possible options include:
- HTML file emailed
- CSV file emailed
Enables and disabled Test Mode (see above).
Amazon Commands Used
The following Amazon AWS commands are used. The access key should have permission to execute all of them.