How to Create a Automate Backup AWS Data Lifecycle Management Using Snapshots

3 minute read
Content level: Expert
0

Automating AWS data lifecycle management using snapshots ensures consistent, cost-effective backups and easy recovery of your data over time.

Introduction

Automating backups using AWS Data Lifecycle Manager (DLM) allows you to create and delete Amazon EBS snapshots on a custom schedule. This process ensures regular backups, cost control, and compliance.

Key benefits include.

  • Define policies for regular backup schedules.

  • Use tags to identify volumes and instances for backup.

  • Retain backups for compliance and audit purposes.

  • Control costs by automatically deleting old backups.

  • Use IAM to control policy access.

  • No charge for using the service, only for the storage used.

Create a Lifecycle Policy

1. Navigate to AWS Management Console:

  • Open your web browser and go to the AWS Management Console.

  • Sign in with your AWS credentials.

2. Go to the Amazon EC2 Dashboard:

  • In the AWS Management Console, click on Services in the top-left corner.

  • Under Compute, select EC2 to navigate to the Amazon EC2 dashboard.

3. Open the Lifecycle Manager Section:

  • On the left-hand side menu, find and click on Lifecycle Manager under Elastic Block Store.

4. Create a Lifecycle Policy:

  • Click the Create lifecycle policy button to start the policy creation process.

Define Policy Type

Choose the Policy Type:

  • In the Create Lifecycle Policy wizard, you will be asked to select a policy type.

  • Choose EBS Snapshot Policy.

  • Click Next to proceed to the next step.

Policy Details

Name and Description:

  • Name: Provide a name for your policy, such as Daily EBS Backup Policy.

  • Description: Optionally, add a description to help identify the policy’s purpose, like This policy backs up production volumes daily.

Target Resources:

  • Select Volumes or Instances: Choose whether to target individual EBS volumes or entire EC2 instances.

  • Using Tags: Specify tags to identify resources to include in the policy. For the example below.

  • Tag Key: Name

  • Tag Value: Production

Configure Policy Schedule

1.Add Schedule:

  • Click on Add schedule to configure when and how often snapshots should be taken.

2. Schedule Details:

  • Name: Provide a name for the schedule, such as DailyBackupSchedule.

  • Frequency: Choose how often snapshots should be taken. For example:

  • Every 10 hours: Snapshots taken every 10 hours.

  • Daily: Snapshots taken once every day.

  • Weekly: Snapshots taken once every week.

  • Start Time: Set the start time for the schedule in UTC format.

Retention:

  • Number of Snapshots to Retain: Specify how many snapshots to keep. For instance, if you want to retain the last 3 snapshots, set this value to 3.

  • Retention Verification: Ensure that older snapshots are being deleted automatically according to the policy to manage storage costs.

Tags

1. Add Tags to Snapshots:

  • Optionally, add tags to the snapshots created by the policy to help identify and manage them.

  • For example, you might add a tag.

  • Key: Environment

  • Value: Production

Review and create

1. Review Your Settings:

Carefully review all the details and settings you’ve configured for your lifecycle policy.

2. Create Policy:

Click on Create policy to finalize and activate the policy.

EXPERT
published a month ago104 views
2 Comments

This article is tagged as relating to "AWS Backup" but describes its more rudimentary and limited predecessor service, Amazon Data Lifecycle Manager (DLM), instead. As a rule, I would recommend using AWS Backup as a much more advanced service and only resorting to the legacy DLM in specialised situations requiring it, such as when starting to use a newly opened AWS region that doesn't yet offer AWS Backup. I also suggest you retag the article for "Amazon Data Lifecycle Manager" and remove the misleading "AWS Backup" tag.

AWS Backup has massive benefits over DLM. As an important example, backup recovery points created of EC2 instances or EBS volumes via AWS Backup otherwise work as regular AMIs and EBS snapshots, able to be used the same way as any AMI or EBS snapshot, but as a prominent difference, those AMIs or snapshots cannot be deleted directly via the EC2 APIs. They can only be deleted via AWS Backup, making it much easier to use IAM policies to control who can delete backups, making it easy to provide powerful protection against inadvertent or malicious deletions of backups.

EXPERT
Leo K
replied a month ago

As another notable benefit, for typical operational purposes, also manually initiated backups/snapshots are advisable to create via AWS Backup. This makes manual operational work easier by allowing a retention time to be specified for each backup (recovery point) created via AWS Backup. If you specify a retention time of 14 or 35 days, for example, AWS Backup will automatically delete the snapshots and AMI when the retention time has elapsed, without requiring any custom Lambdas, manual reviews, or anything else beyond the standard AWS Backup service to leverage.

By comparison, a manual AMI or EBS snapshot created via the EC2 console will linger in the account forever, unless someone manually deletes them or builds custom code to help, contrary to the general best practice of using standard, cloud-native services when they're available.

EXPERT
Leo K
replied a month ago