Shell script to automatically remove old AWS Lightsail snapshots (and retain only a specific number of snapshot backups)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Lightsail Backup and Clean Up Shell Script




Shell script to automatically backup a Lightsail snapshot and then remove old AWS Lightsail snapshots (by retaining only a specific number of snapshot backups).

This script will take in three arguments.

  1. The instance you want to backup
  2. The AWS region where the lightsail instrance is located.
  3. The number of backups that you would like to keep.

To execute the script:

'$ bash [instance] [region] [backups kept] '

Scheduling Backups

Follow the instructions referenced in the below blog which includes how to configure the AWS CLI and schedule the jobs in crontab:

Special Thanks