Create EBS Snapshot Lifecycle Policy with DLM

Snapshots are an easy way to back up data on EBS volumes to S3. Amazon Data Lifecycle Manger for EBS Snapshots makes this process quick and simple. 

This guide will show you how to create a simple policy that takes daily snapshots using DLM. If you want more detailed information on EBS snapshots, see here.

Tags-Tagging

Before creating the snapshot lifecycle we need to set a tag that will be used to identify which instance(s) the policy applies to. This tag can be anything you like. I’ve gone with the highly original tag Backup-Snapshot, as shown below.  

Create Snapshot Policy

Once you have applied your chosen tag to the instance(s) or volumes that you wish to snapshot you can create the snapshot lifecycle policy. To do this select ‘Lifecycle Manager’ from the left hand menu in the EC2. When you first do this you will be present with the screen shown below. 

Firstly, set a description for your new lifecycle policy and select the resource type. If you chose ‘Instance’ the policy will snapshot each volume attached to each instance that. 

Next you need to add the tag (both key and value) that is applied to instance(s) that you want the policy to apply to. These will appear in the drop down and you will just need to select them. 

You will then need to define your policy schedule. Set the schedule name and choose how frequently to run the policy. You have a choice of 2, 3, 4, 6, 8, 12 or 24 hours. As we are doing a daily snapshot we’ll chose 24 hours. 

Select a time to start the snapshots and the number of snapshots to retain. 

The next step is to set the tagging information. You can copy the tags from the volume as well as adding further tags. 

As we chose Instance as our resource type we are given the below option to exclude snapshots of the root volume. For this example we’ll leave the option unticked so snapshots of our root volume are taken. 

Finally we must associate an IAM role with the policy. For this example we will use the AWS Default role, but you may create a separate IAM role if you wish. 

Review the Policy Summary and select whether you would like to enable the policy after creation.  

That’s it, snapshot lifecycle policy created!

This policy can now be used to manage snapshots for any EC2 instance in your account, you just need to add the appropriate tag. 

A little extra...

To speed things up a little you can deploy the policy through Cloudformation. You can download my template here. This template will create the exact same policy as the one created in this guide. 

1 thought on “Create EBS Snapshot Lifecycle Policy with DLM”

  1. Pingback: AWS Backup - AWS Pro

Comments are closed.