Simple AWS Backup/Retention Solution in NodeJS

Posted: December 23, 2015

I needed a tool which would create snapshots and remove them based on a per-volume retention period. There's plenty of scripts out there but I found nothing ideal, so I decided to write a utility from scratch utilizing NodeJS and the aws-sdk module.

I didn't want to maintain config files outside of AWS to define what should be backed up and how long they should be retained. I decided to leverage the AWS resource tagging to define what volumes should be managed with this automated backup management tool.

All that is required is to add the tag Snapshot to the volumes you would like to backup. The value of that tag is the number of days you would like the snapshot to be retained. (Use "0" to retain the snapshots indefinitely)

Once the tags are setup, simply set the script to run once per day via cron.