A Serverless function (runnable on AWS Lambda) to manage incremental snapshots of AWS Lightsail instances.
Inspired by/based on vidanov/lambda-nodejs-lightsail-backup & weareadjacent/lambda-lightsail-backup.
See Serverless Getting Started with
By default, this will backup all lightsail instances in the current region, nightly. It will retain daily backups for 14 dyas, weekly backsups for 12 weeks and monthly backups for 12 months. These can be configured in serverless.yml with the environment variables.
environment:
# BACKUP_INSTANCES: 'instance1,instance2'
# BACKUP_DAYS: 7
# BACKUP_WEEKS: 12
# BACKUP_MONTHS: 12
Make sure you setup your AWS region in serverless.yml
You can adjust when the backups will be executed in serverless.yml by changing the cron schedule
- schedule: cron(0 3 * * ? *)
You can test this locally by using $ serverless invoke local -f backups
$ serverless deploy