AWS - Elastic Block Storage(EBS)

Demo on creating an EBS in AWS

Managing Persistent Block Storage for the Cloud

What is Amazon EBS?

Amazon Elastic Block Store (EBS) provides high-performance, persistent block storage volumes for use with Amazon EC2 instances. Think of an EBS volume as a virtual hard drive in the cloud. Unlike instance store volumes (which are ephemeral), data on an EBS volume persists independently of the life of the instance.

1. Working with EBS Volumes

A volume is the active storage unit that you attach to your instance to store data, install operating systems, or run databases.

Steps to Create and Attach a Volume:
  1. Navigate to EC2 Console: Under "Elastic Block Store," choose Volumes.
  2. Create Volume: Click "Create volume." Select the Volume Type (e.g., gp3 for general purpose, io2 for high performance).
  3. Set Size and Zone: Enter the size in GiB and select an Availability Zone (this must match the zone of your EC2 instance).
  4. Attach Volume: Once created, select the volume, click Actions > Attach volume, and select your running instance.
  5. Mount: Log into your instance to format the volume with a file system (like ext4 or NTFS) and mount it to a directory.

2. Understanding EBS Snapshots

A Snapshot is a point-in-time, incremental backup of an EBS volume. Snapshots are stored in Amazon S3 for high durability, but they are managed through the EC2 console.

  • Incremental Backups: Only the blocks that have changed since the last snapshot are saved. This reduces storage costs and backup time.
  • Durability: Snapshots are automatically replicated across multiple data centers within a region.
Steps to Create a Snapshot:
  1. Select Volume: In the Volumes list, select the volume you want to back up.
  2. Create Snapshot: Click Actions > Create snapshot.
  3. Add Description: Provide a name or description for the backup and click "Create snapshot."

3. Restoring Data from Snapshots

Restoring data involves creating a new volume from a snapshot. This is the primary method for disaster recovery or cloning environments.

Steps to Restore/Clone a Volume:
  1. Navigate to Snapshots: Select the snapshot you want to restore.
  2. Create Volume from Snapshot: Click Actions > Create volume from snapshot.
  3. Configure New Volume: You can change the volume type or increase the size during this step. Ensure the Availability Zone matches your target instance.
  4. Attach: Once the new volume is "available," attach it to your EC2 instance.

Common Use Cases

Database Storage

Hosting mission-critical databases (MySQL, Oracle, SQL Server) that require high IOPS and data persistence even if the compute instance is stopped.

Disaster Recovery

Using snapshots to back up data across different Availability Zones or copying snapshots to different Regions to protect against regional outages.

Data Migration & Cloning

Creating a snapshot of a production volume to create a "test" volume for developers, allowing them to work with real data in a safe, isolated environment.

Dynamic Resizing

Using the Elastic Volumes feature to increase the size or change the performance characteristics of a volume without any downtime.

Summary

The combination of Volumes for active use and Snapshots for cost-effective backups provides a robust data management strategy. By automating snapshots with Amazon Data Lifecycle Manager (DLM), organizations can ensure consistent protection of their cloud data assets.