GenAIHub
← Back to Technical Section

Amazon Elastic Block Store (EBS)

Scalable, high-performance block storage for Amazon EC2

What is Amazon EBS?

Amazon Elastic Block Store (Amazon EBS) is a scalable, high-performance block storage service designed for use with Amazon EC2 instances. EBS volumes behave like raw, unformatted block devices, allowing you to create a file system, run a database, or use them in any way you would use a block device. EBS provides persistent storage, meaning your data remains available even after you stop or terminate your EC2 instances.

EBS volumes are highly available, durable, and can be dynamically scaled to meet the storage needs of your applications. With features such as snapshots, encryption, and multiple volume types optimized for performance or cost, Amazon EBS is a foundational storage solution for a wide range of workloads, including databases, enterprise applications, and containerized environments.

Architecture

Amazon EC2 Instance EBS Volume EBS Snapshot

Key Components

EBS Volumes

Block-level storage devices that you can attach to EC2 instances. Volumes persist independently from the life of an instance and support multiple volume types for different performance and cost needs.

EBS Snapshots

Point-in-time backups of EBS volumes stored in Amazon S3. Snapshots can be used to restore volumes or create new ones, enabling disaster recovery and data migration.

Encryption & Security

EBS supports encryption at rest and in transit, using AWS Key Management Service (KMS) for key management, ensuring data security and compliance.

Key Capabilities

High Performance

Supports high IOPS and throughput for demanding workloads such as databases and analytics.

Durability & Availability

Data is automatically replicated within an Availability Zone to protect against hardware failure.

Snapshots & Backup

Create point-in-time backups and restore volumes quickly for disaster recovery or migration.

Common Use Cases

Database storage (MySQL, Oracle, SQL Server)
Enterprise applications (SAP, Microsoft Exchange)
Big data analytics
Backup and disaster recovery
Container storage (Kubernetes, ECS)
Boot volumes for EC2

Implementation Example

# Terraform Example: Create an EBS Volume and Attach to EC2

resource "aws_ebs_volume" "example" {
  availability_zone = "us-west-2a"
  size              = 8
  type              = "gp3"
}

resource "aws_instance" "example" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t2.micro"
}

resource "aws_volume_attachment" "ebs_att" {
  device_name = "/dev/xvdf"
  volume_id   = aws_ebs_volume.example.id
  instance_id = aws_instance.example.id
  force_detach = true
}

This Terraform configuration creates an 8 GiB gp3 EBS volume in the specified Availability Zone, launches an EC2 instance, and attaches the EBS volume to the instance. You can modify the size, type, and other parameters as needed.

Related Topics

Test Your Knowledge

Score 8/10 or higher to pass