How to create automatic snapshots (backups) of EC2 storage volumes using Data Lifecycle Manager

Written by - 0 comments

Published on - Listed in AWS Cloud Backup


In a previous article we described how automatic backups (snapshots) of EC2 instances could be scheduled using AWS Cloudwatch. Although Cloudwatch does the job, there's a simpler and better way to create snapshots: Data Lifecycle Manager.

Data Lifecycle Manager

Data Lifecycle Manager (DLM) can be found inside the EC2 service under the Elastic Block Storage (EBS) navigation point. It was made to manage and schedule the creation and deletion of EBS snapshots and is relatively new (introduced in July 2018).

DLM runs one or more policies where each policy has its own schedule and its own targets. Targets can be either EBS volumes or EC2 instances selected by tags.

The nice thing is: DLM is much easier and more self-explanatory than the previous volume snapshot method using Cloudwatch.

Create a new Snapshot Lifecycle Policy

There is a couple of information which needs to be entered in order to create a policy:

  • Description: Obviously a description of your snapshot policy. Should help you to quickly identify what you are looking for.
  • Resource Type: Either select EBS Volume(s) or EC2 Instance(s).
  • Target tags: The policy works with tags. If you haven't created tags on your EBS volumes or EC2 instances yet, there's a good reason now! In this case a simple "Name" tag was used on the EC2 instances, selecting a total of three instances (note the blue +2).
  • Policy Schedule: This is the frequency how often you want to run this policy. In this example, the policy runs on a daily basis, creates a snapshot every 12 hours (at 05:00 UTC and 17:00 UTC) and keeps 14 snapshots.

After defining the schedule, optional settings can be selected:

  • Fast snapshot restore: Allows to directly access the snapshot for faster access (the official description is somewhat wacky) as it creates a fully initialized volume at creation. As these snapshots are created for backup purposes only, fast restore is rarely needed.
  • Enable cross region copy: That's a cool feature but it comes with a cost (of course). You can backup your machine running in eu-west-1 and have the backups stored in another region, for example us-east-1.
  • Exclude snapshot of root volume: This would prevent making a snapshot of the instance's root volume. But for a full instance backup this is of course needed.

The creation of the policy ends with two more settings: IAM Role (which can use the default rule) and whether or not to enable to policy straight away:

At the end a summary is shown how the policy was scheduled. Note the maximum number of snapshots! It may be too few, depending on the snapshot frequency.

The snapshots are showing up

The snapshots created by a DLM policy are showing up under Elastic Block Store -> Snapshots. A nice difference can be seen here between the Cloudwatch and the DLM snapshot method: The snapshots created by Data Lifecycle Manager contain a description which policy is at the origin of the snapshot! This makes it much easier to spot the wanted volume snapshot.

EBS Volume Snapshots created by Data Lifecycle Manager Policy


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.