Description

The Delete Lightsail Instance Snapshots action can be used to delete many Lightsail snapshots based on specific criteria. Possible criteria includes the snapshot's name or instance's name.

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 only snapshots that contain "prod" in it's instance's name.
  • delete snapshots that contain "backup" in it's name and are older than 5 days

Test Mode

The Delete Lightsail Instance 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.

Important Note

Criteria acts as a filter. If no criteria is specified, all snapshots will be deleted.

Settings

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. Possible options include:

  • All Snapshots - All instance snapshots will be selected.
  • By Instance Name - Each snapshot's originating instance name will be compared.
  • By Instance Snapshot Name - Each snapshot's name will be compared.

Instance Name

Indicates the comparison to perform on each snapshot's instance's name.

Snapshot Name

Indicates the comparison to perform on each snapshot's name.

Delete Scheme

Indicates the algorithm used to determine which the selected snapshots will be preserved or deleted. Possible options include:

  • Delete All Snapshots - All selected snapshots will be deleted
  • First In First Out - Older snapshots will be deleted, preserving newer snapshots
  • Grandfather-Father-Son - A Grandfather-Father-Son scheme will be applied to the snapshots

Older Than (days)

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.

Grouping Method

Optionally groups the snapshots. When grouped, each group is processed independently from the others.

Test Mode

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.

  • lightsail:DeleteInstanceSnapshot
  • lightsail:GetInstanceSnapshots
Did this answer your question?