Create automatic snapshot of EBS volume using Amazon DLM

Lab Details

  1. This lab walks you through the steps to launch and configure a virtual machine in the Amazon cloud for the purpose of automating the creation of EBS Snapshots attached to this EC2 Instance every hour.

  2. You will practice using Amazon Data lifecycle manager to create an EBS Snapshot policy with a custom duration of 1 hour using cron.

  3. Duration: 90 minutes

  4. AWS Region: US East (N. Virginia) us-east-1

Introduction

What is Amazon Data Lifecycle Manager (DLM)?

  • DLM is used to manage the lifecycle of AWS resources.

  • DLM helps to automate the creation, retention, and rotation of EBS Volumes, EBS Snapshots, and EBS-backed AMIs.

  • Using the capabilities of CloudWatch events and CloudTrail, it provides the backup of EBS volumes attached to EC2 Instances at no additional cost.

  • It cannot be used to automate the creation, retention, and rotation of instance store-backed AMI.

  • Automating the EBS Volumes helps you in the following things:

    • Protects your data as you have the latest backup.

    • Create AMI with the latest data, apps, and software already present in it.

    • Meet the compliance requirement by retaining the backups.

    • Reduce storage costs by deleting outdated backups.

  • For this lab, you will have to wait for an hour after creating the Snapshot policy.
    AWS Documentation link:
     
    https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshot-lifecycle.html

What is EC2?

  • AWS defines it as Elastic Compute Cloud.

  • It’s a virtual environment where “you rent” to have your environment created, without purchasing. 

  • Amazon refers to these virtual machines as Instances.

  • Preconfigured templates can be used to launch instances. These templates are referred to as images. Amazon provides these images in the form of AMIs (Amazon Machine Images).

  • Allows you to install custom applications and services.

  • Scaling of infrastructure i.e., up or down is easy based on the demand you face.

  • AWS provides multiple configurations of CPU, memory, storage, etc., through which you can pick the flavor that's required for your environment.

  • No limitation on storage. You can pick the storage based on the type of instance that you are working on.

  • Temporary storage volumes are provided, which are called Instance Store Volumes.  Data stored in this gets deleted once the instance is terminated.

  • Persistent storage volumes are available and are referred to as EBS (Elastic Block Store) volumes.

  • These instances can be placed at multiple locations which are referred to as Regions and Availability Zones (AZ).

  • You can have your Instances distributed across multiple AZs i.e., within a single Region, so that if an instance fails, AWS automatically remaps the address to another AZ.

  • Instances deployed in one AZ can be migrated to another AZ.

  • To manage instances, images, and other EC2 resources, you can optionally assign your own metadata to each resource in the form of tags.

  • A Tag is a label that you assign to an AWS resource.  It contains a key and an optional value, both of which are defined by you.

  • Each AWS account comes with a set of default limits on the resources on a per-Region basis.

  • For any increase in the limit, you need to contact AWS.

  • To work with the created instances, we use Key Pairs.

Architecture Diagram

Task Details

  1. Launching Lab Environment

  2. Launching an EC2 Instance

  3. Create an EC2 Snapshot policy using Lifecycle Manager

  4. Wait for an hour

  5. Check the automated snapshot

  6. Deleting AWS Resources