Hello folks, in this article I will be showing you how to setup snapshot lifecycle in AWS. This is newly added feature in AWS, but it is available is very limited regions.
In AWS you can setup automated snapshots using cloudwatch scheduled events. But the main issue is snapshots can grow into a large list. So there needs to be some workaround to delete the old snapshots. Many people have created their own workaround for managing snapshots and cleaning up old snapshot and through step functions. Many customers have created their own workaround this by using some tools to automate snapshots creation and deletion. But this starts turning into huge aws bills for them, also the scripts were not working as expected. AWS tried to bridge this gap to keep customers on top priority by introducing the Data Lifecycle Manager. The Data Lifecycle Manager is created with a vision to help customers save money and to be able to rest assured that their snapshots are being managed as expected.
Lifecycle Management – The Amazon Data Lifecycle Manager
To make it easier for customer to create, use, and benefit from EBS snapshots! AWS has launched Amazon Data Lifecycle Manager. It facilitates automation for the creation, retention, and deletion of Amazon EBS volume snapshots. To use this DLM tool, you need to create a policy, using tags you need to indicate which volumes are to be snapshotted, then you need to set a retention model, fill in a few other details, leave rest of the things handled by tool. Data life cycle manager works on tagging concept, so better setup a detailed tagging model for your organization.
Creating and Using a Lifecycle Policy
DLM uses lifecycle policies to schedule out when to run, which volumes to be snapshotted, and how long to retain the snapshots around. You can create the lifecycle policies in the AWS Management Console, from the AWS Command Line Interface (CLI) or via the DLM APIs.
The Data Lifecycle manager is not available in all aws regions, it is available in Virginia region as of now. You can see this option on left side under Elastic Block Store.
Points to remember:
Please remember following points in mind while starting to use Data lifecycle manager to automate your snapshot management:
- Data Consistency – Snapshots will contain the data from all completed I/O operations, also known as crash consistent.
- Pricing – You can create and use Data Lifecyle Manager policies at no charge; you pay the usual storage charges for the EBS snapshots that it creates.
- Availability – Data Lifecycle Manager is available in the US East (N. Virginia), US West (Oregon), and EU (Ireland) Regions.
- Tags and Policies – If a volume has more than one tag and the tags match multiple policies, each policy will create a separate snapshot and both policies will govern the retention. No two policies can specify the same key/value pair for a tag.
- Programmatic Access – You can create and manage policies programmatically! Take a look at the CreateLifecyclePolicy, GetLifecyclePolicies, and UpdateLifeCyclePolicy functions to get started. You can also write an AWS Lambda function in response to the createSnapshot event.
- Error Handling – Data Lifecycle Manager generates a “DLM Policy State Change” event if a policy enters the error state.