Automate your Amazon EBS Snapshot Creation and Deletion using EBS Lifecycle Manager

Published by Vignesh M on

AWS provides an option to take snapshots of the EBS volume. EBS snapshots come handy when we want to recover our EBS volumes from any unforeseen disasters or failures. It would be even nice if you can automate your Amazon EBS snapshot creation and deletion. It’s quite simple using the EBS Lifecycle Manager service provided by AWS.

Create the Snapshot Lifecycle Policy

  • Go to EC2 console and access the Lifecycle Manager under the section Elastic Block Storage in the left navigation pane.
  • You should get a page similar to the image below.

  • For the volumes to be targeted for taking snapshots, the tags associated with the volumes can be used.
  • For example, in the example shown above volumes with tag Identifier: ebs_prod_rayfocus will be considered for snapshot creation as per the configuration.
  • Input the details for the duration between each snapshot creation. Currently the snapshots can be configured to be taken every 12 or 24 hours.
  • Then, the snapshot creation time in UTC.
  • Another useful option is the ability to configure the number of snapshots to retain as a whole. This can vary per the use case and the need.
  • You have to attach the IAM policy which gives the necessary permissions to access the EC2 resources and to manage the snapshots.
  • The IAM role can also be generated automatically using the Lifecycle rule. AWS automatically creates one and uses it to manage the snapshots.

  • Just hit the Create Policy and it’s all set for managing the EBS snapshots.
  • The IAM default role created should be similar to the one shown below.

Conclusion

Before the introduction of the EBS Lifecycle Manager service by AWS, we have to write custom tools to manage the EBS snapshots. But now it’s lot more easier and simple to manage EBS snapshots without any hassle. If you are using any other approaches to manage the snapshots please let know in the comments section.


Vignesh M

Java developer , AWS Certified Solutions Architect Associate and Cloud technology enthusiast. Currently working for Hexaware technologies. He believes that knowledge increases by sharing not by saving.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.