Day-20: EBS Volumes & Snapshots


💾 What is Amazon EBS (Elastic Block Store)?

Amazon EBS provides block-level storage for EC2 instances.

It acts like a virtual hard disk that can be attached to EC2 instances for data storage.

EBS is designed for high availabilitylow latency, and persistent storage, meaning your data remains intact even after stopping or restarting the EC2 instance.


⚙️ EBS Volume Basics

Concept Description
Volume A virtual hard drive attached to an EC2 instance.
Persistence Data remains after instance stops or restarts.
Availability Zone (AZ) EBS volumes are created within a single AZ — must be attached to instances in the same AZ.
Attach/Detach You can attach or detach volumes from instances as needed.

🧱 Types of EBS Volumes

Type Description Use Case
gp3 / gp2 (General Purpose SSD) Balanced price and performance Most common use (boot volumes, general apps)
io1 / io2 (Provisioned IOPS SSD) High performance, low latency Databases & high I/O workloads
st1 (Throughput Optimized HDD) Low-cost, high throughput Big data, data warehousing
sc1 (Cold HDD) Lowest cost Infrequently accessed data

💡 Basic EBS Commands (AWS CLI)

# Create EBS volume
aws ec2 create-volume --availability-zone ap-south-1a --size 10 --volume-type gp3

# Attach EBS volume to an instance
aws ec2 attach-volume --volume-id vol-xxxxxxxx --instance-id i-xxxxxxxx --device /dev/xvdf

# Detach EBS volume
aws ec2 detach-volume --volume-id vol-xxxxxxxx

# Delete EBS volume
aws ec2 delete-volume --volume-id vol-xxxxxxxx


📸 EBS Snapshots

Snapshots are point-in-time backups of your EBS volumes.

They are stored in Amazon S3 (internally managed by AWS) — not visible directly in S3 buckets.

✅ Features of Snapshots: