How to Automate AWS EC2 Instance Backups - Amazon Data Lifecycle Manager
Tags: cloud, beginners, devops, aws
Published: 2022-02-17 08:53:09

## DAY 10 -  How to Automate AWS EC2 Instance Backups - Amazon Data Lifecycle Manager 
☁️ [100 days of Cloud- **Day Ten**](https://github.com/anuvindhs/100daysofcloud)
 ✅ [Follow Me on Twitter](https://twitter.com/anuvindhs)



![Image Cover](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ib84ehm2fxexq5px23q9.jpg)

[Tweet This Blog](https://link.anuvindh.com/twitter/DAY-10-DLM.html)  - [Read on GitHub](https://github.com/anuvindhs/100daysofcloud) - [Read On iCTPro.co.nz](https://ictpro.co.nz)

--------

## 🖴 Automated Snapshots

You can create an automated solution using Amazon Data Lifecycle Manager. It will create, copy, delete &  retention of EBS snapshots and EBS-backed AMIs.

## 🚀 Fast Snapshot Restore integration
You can restore the volume immediately by enabling fast restore and instantly deliver all of their provisioned performance.

## 🏤 Cross-region Copy
You can copy snapshots to other AWS regions automatically. (Disaster recovery) 

## 🧑🏼‍🤝‍🧑🏻 Cross-Account Copy
Automate Snapshots across multiple  account.

## 📒 Tutorial , How to?

In this tutorial we will setup policy to take snapshot in every day and keep last three copies.

Sign in to **AWS account** and go to **EC2 Dashboard**.

Select your EC2 and give a tag , **Key** as **Snapshot**
and **Value** as **True**

![Image Tag](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nxcb1vchzkqugod4hd35.png)

then ,

|  Comments | Screenshots  |
| ------------ | ------------ |
| Click on to ** Lifecycle  Manager**  Under **Elastic Block Store** | ![LCM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zv6x0lqganr3u77opxel.png)   |
| Now Select **EBS-Backed AMI Policy** and click **Next step**|![ami-backed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqqgwdw3o7p6nswkgdtk.png)|

Now we need to add the tags , these tags should be the same tag attached with ec2 which you are trying to backup. in this case its **Snapshot**:**True**


|  Comments | Screenshots  |
| ------------ | ------------ |
|Add tag |![Image tag](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3928bvr2o7kekkte5yd7.png)|
|**add** an Policy description and leave **IAM role** to **Default Role**|![Image IAM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tjhpdus3pljtc8c3kmja.png)|
|Now you can **add Tag** for your DLM Policy|![Image Policytag](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fac98dmgfzpcwc8q8x4i.png)|
|Policy Status **Enabled**, you can reboot instance after snapshot if you want to else leave it as **default** and click **Next**|![Image Plicy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/voisbyods8n2w3mqlb4y.png)|

Now Lets Setup the time and retention type and amount of backups to keep . The time Zone is UTC, if you wanna change to your time zone make sure you convert UTC to desired timezone. Here is [Savvy Time](https://savvytime.com/converter/utc-to-nzst) , a helpful tool to convert time zones.


![Image DLMTIME](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t4jkgxtpa9oqd91rouq6.png)
 
if you want to add tags for the instance click **Copy tags from source**. Name the DLM policy using tag. Also if you prefer to do cross region copy , **Enable cross-Region copy for this schedule**.

![Image last](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hwyui8i4pc53j6nirhgg.png)

Once you reviewed , Click **Create Policy**.

**🎉Congratulations🎉** you have successfully configured an DLM policy to take snapshots automatically. 



{% user anuvindhs %}