Skilly
3 min readDec 31, 2023

--

Efficient Solution to take Daily Snapshots of its Amazon Elastic Block Store
(EBS) volumes.

The process of taking daily snapshots of an EBS volume can be time-consuming and error prone if done manually. I guess there is no use of doing some activities manually especially if they can be automated. With me today is an automated way of taking daily EBS volume snapshots and improve data backup and recovery processes and ensure business continuity.

To get through with this process you need to be logged in to your aws.amazon.com account. For automated daily snapshots AWS provides you with a service that makes this process simple “Data Lifecycle Manager”.

Go to your AWS management console and navigate to DLM (Data Lifecycle Manager) service. Create a new lifecycle policy for your EBS volumes, specifying the schedule for daily snapshots.

  • Define the target volumes by selecting specific tags, resource IDs, or specifying volume types.
  • Configure the snapshot frequency (e.g., daily) and the time at which snapshots should be taken.

Establish a retention policy within DLM to manage the number of snapshots retained. The retention period for snapshots is defined based on business requirements ensuring older snapshots are automatically deleted.

For an automated process you need to monitor if the process taking place is correct to avoid any errors in the process. You can set up notifications using CloudWatch events. This service triggers when snapshots are created or if there are any errors. Generate reports according to your preference on snapshot creation status.

CloudWatch logs comes in handy which makes it possible and easy for error handling where you can establish reports on failed snapshot or policy related errors. You can implement automated scripts or lambda functions to handle specific errors. e.g. retry failed snapshots, update policies, notify administrators.

For Security purposes apply the principle of least privilege by configuring IAM roles and policies for DLM to limit access to necessary resources only. Utilize AWS Resource-Level Permissions to control who can modify DLM policies or access snapshots.

Implementing automated snapshot creation with DLM ensures regular backups, facilitates data retention policies, enables monitoring and error handling, and prioritizes security measures for EBS volumes on AWS.

You can go ahead and try this with CloudFormation;

Resources:
MyDLMResource:
Type: "AWS::DLM::LifecyclePolicy"
Properties:
Description: "Daily EBS Snapshot"
PolicyDetails:
PolicyType: "EBS_SNAPSHOT_MANAGEMENT"
ResourceTypes:
- "VOLUME"
TargetTags:
- Key: "Environment"
Value: "Production"
Schedules:
- Name: "DailySnapshot"
CopyTags: true
TagsToAdd:
- Key: "SnapshotType"
Value: "Automated"
CreateRule:
Interval: 24
IntervalUnit: "HOURS"
Times:
- "06:00"

--

--