Browse the Repo
Browse the Repo
Snapshot your EC2 instances on a scheduled basis.
NOTE: This module is deprecated and will be removed in the future. Use the Data Lifecycle Manager based backup system instead.
This module can be used to make scheduled backups of an EC2 Instance and its EBS Volumes. Under the hood, this module uses package-lambda to deploy a Lambda function that is triggered on a scheduled basis by Amazon CloudWatch Events and runs ec2-snapper to take a snapshot of the EC2 Instance.
As an alternative to lambda functions using
ec2-snapper, we also have the ec2-backup
module in the repo
uses AWS Data Lifecycle Managers (DLM) to
manage the EBS snapshots. Unlike with lambda functions, this is an AWS native solution that does not have any
infrastructure to manage.
Additionally, Data Lifecycle Managers work through the use of tags on volumes, unlike the lambda function (which selects volumes by EC2 instance). This means that the backup function is able to group all the snapshots together across deployments. For example, if you wanted to support blue green deployments for your jenkins server and you rotated instances, the snapshots for the previous instance would still be managed using the same DLM policy.
However, there are a few features that the lambda based backup functions support which are currently not available with DLM:
To specify the instance to backup, you simply provide the instance's name via the
instance_name parameter. This
should correspond to a tag on your EC2 Instance
with the name
You can specify how often this lambda function runs using the
backup_job_schedule_expression parameter. This can
be either a rate expression such as
rate(1 day) or a cron expression such as
cron(0 20 * * ? *). See Schedule
Expressions for more information and
Every time the function runs successfully, it will increment a CloudWatch Metric. We've configured a CloudWatch alarm to go off if the metric is not updated on the expected schedule, as that implies the backup has failed to run!
You can specify the metric namespace and name using the
parameters, respectively. You can specify the SNS topic to notify when the alarm goes off using the
To prevent the number of snapshots from growing infinitely and costing you a lot of money,
automatically delete older snapshots. You can specify two parameters to control how many snapshots are kept around:
delete_older_than: Delete all snapshots older than this duration. For example, if you set this parameter to
then snapshots that are more than 30 days old will be deleted. See Delete AMIs older
than for more info.
require_at_least: Always keep around at least this many snapshots. This helps avoid deleting too much if you have,
for example, a misconfiguration of the
We're here to talk about our services, answer any questions, give advice, or just to chat.