Amazon Data Lifecycle Manager
EBS snapshots play a vital role in the effective data management of Amazon Web Services (AWS). These snapshots, serving as backups for EBS volumes, find their home in Amazon Simple Storage Service (S3). While essential for safeguarding data and preparing for unforeseen disasters, handling EBS snapshots can be intricate and time-consuming. Enter Amazon DLM, an elegant solution that eliminates the need for complex, custom scripts to manage EBS snapshots.
Amazon DLM simplifies the process of creating, managing, and deleting EBS snapshots by offering an automated approach. This is achieved through resource tags applied to EBS volumes or EC2 instances. The result? A reduction in operational complexity, saving both time and money. And here's the cherry on top: Amazon DLM is freely available for use and accessible across all AWS Regions.
Create a Lifecycle Policy
-> Navigate to EC2 Console
-> Select the Lifecycle Manager under the Elastic Block Store in the navigation pane
-> Select custom policy and EBS Snapshot policy as type
-> Select Next step
In this example we will cover the Disk volume as target
-> In Specify Settings Page
-> Select Volume as target resource type
-> Add the target resource TAG Key name and value
-> Add a policy description in the description section
-> Select the default IAM role and Scroll down
-> Set Policy status - Enabled
-> Select Next
Here I am going to setup one schedule, daily snapshot with retention count as five snapshots. Also we will cover her the advanced settings of the Tagging, Fast snapshot restore and cross-region copy
-> Enter Schedule name
-> Frequency:Daily | Every:24 hours | Starting at: 21:00 | Retention Type: Count | Keep: 5
Move to the Advanced settings( This section is actually optional)
-> Select the checkbox of Copy tags from source in the tagging info section
-> Enable the Fast Snapshot Restore option under the Fast Snapshot Restore section
[Fast Snapshot Restore: The Amazon EBS Fast Snapshot Restore (FSR) feature empowers you to generate a volume from a snapshot that is entirely initialized upon creation. This eradicates the latency associated with I/O operations on a block when it is initially accessed. Volumes produced through Fast Snapshot Restore promptly provide their full provisioned performance. Additional charges applied depends the number of snapshots and AZ we enabled the FSR]
-> Enter how many number of snapshots enabled for FSR
-> Select the Availability Zone to enable FSR
-> Enabled cross region copy for this schedule checkbox
-> Select the target region, expire days/weeks/months
-> Enable the encryption
-> Select a multi region KMS key
-> Select copy tags from source
-> Select review policy
-> Review the page
-> Scroll down and Select Create Policy
-> You should get the message that the policy created successfully
Monitoring
Amazon DLM sends notifications about Amazon EBS snapshot lifecycle events to the AWS CloudTrail console's Event history page. You can find events associated with the creation or deletion of EBS snapshots by filtering under the User name as DataLifecycleManager.
Clean up
If you have generated test EBS volumes, along with Amazon DLM policies for creating EBS snapshots, utilizing KMS Keys, implementing FSR, and duplicating EBS snapshots across AWS Regions — considering this is a testing environment — you might not require preserving the AWS resources. Consequently, it is advisable to remove the allocated AWS resources to prevent additional charges. In this illustration, deleting the AWS resources is recommended.