The Delete Directory Service Snapshots action can be used to delete many AWS Directory Service snapshots based on specific criteria. Possible criteria includes the snapshot's name or directory's name.
For example, it can be used to:
- delete all snapshots
- delete all snapshots 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
The Delete Directory Service 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.
Criteria acts as a filter. If no criteria is specified, all snapshots will be deleted.
Please see Common Action Settings for a description of settings common to all action types.
Optional. When enabled, this indicates a way to compare snapshot information as a way to include or exclude snapshots from deletion.
Older Than (days)
Optional. When enabled, only snapshots older than the specified number of days will be deleted.
Minimum To Keep
Optional. When enabled, indicates the minimum number of snapshots to keep. Newer snapshots are favoured to keep over older snapshots.
When enabled, the action will apply to snapshots on a per-directory basis. Only the following options are affected by this option:
- Minimum To Keep - This value will indicate the number of snapshots per-directory to keep.
If none of the above options are enabled, then the "Process Per-Directory" behaviour will not be any different than if it was not enabled.
Enables and disabled Test Mode (see above).
All snapshots are sorted by their creation date in descending order, then criteria are checked (when enabled) against each snapshot in the following order:
- Delete Comparison
- Minimum to Keep
- Older Than (days)
Amazon Commands Used
The following Amazon AWS commands are used. The access key should have permission to execute all of them.