
Amazon EBS Explained: Volume Types, Snapshots, Encryption and EBS vs EFS
A beginner-friendly guide to Amazon EBS: volume types, mounting and resizing, snapshots, Multi-Attach, encryption, and when to choose EBS over EFS, with commands, common mistakes, and a quick revision cheat sheet.
When you launch an EC2 instance, where does your data actually live?
Applications need storage for operating systems, databases, application files, logs, and backups. In AWS, one of the most commonly used storage services for EC2 is Amazon Elastic Block Store (EBS).
But EBS is more than just a virtual hard drive. Understanding its volume types, snapshots, encryption, and advanced features can help you build more reliable and secure cloud infrastructure.
Let's explore the important concepts.
1. What is Amazon EBS?
Amazon Elastic Block Store (EBS) is a block-level storage service designed primarily for use with Amazon EC2 instances.
Think of it as a virtual hard drive that you can attach to an EC2 instance.
Unlike temporary EC2 Instance Store storage, EBS volumes persist independently of the EC2 instance, even after it is stopped or terminated, provided the volume is configured to be retained.
Key points:
- EBS provides persistent block storage.
- Volumes are created in a specific Availability Zone.
- You can increase volume size and modify performance.
- Volumes can be backed up using snapshots.
- Data can be encrypted using AWS Key Management Service (KMS).
EBS vs Instance Store: EBS provides persistent storage, whereas Instance Store provides temporary storage physically attached to the host. Instance Store data is lost when the instance is stopped, hibernated, or terminated.
2. Understanding EBS Volume Types
Choosing the right EBS volume depends on your application's performance requirements, workload, and budget.
AWS provides two main categories:
SSD-backed volumes
Volume type | Best use case |
|---|---|
gp3 | General-purpose applications and databases |
gp2 | General-purpose workloads (previous generation) |
io2 | High-performance, I/O-intensive databases |
io1 | Provisioned IOPS workloads (previous generation) |
HDD-backed volumes
Volume type | Best use case |
|---|---|
st1 | Frequently accessed, throughput-intensive workloads |
sc1 | Infrequently accessed, cold data |
A few important things to remember:
- gp3 provides a baseline of 3,000 IOPS and 125 MiB/s throughput, included in its storage price.
- gp3 is generally more cost-effective than gp2 at comparable performance levels.
- io2 is suitable for demanding, I/O-intensive workloads.
- st1 and sc1 are designed for large, sequential workloads and cannot be used as boot volumes.
For most general-purpose workloads, gp3 is a good starting point.
3. Creating and Attaching an EBS Volume
Let's understand how to attach an additional EBS volume to an EC2 instance.
The basic steps are:
- Open the EC2 Dashboard.
- Navigate to Elastic Block Store → Volumes.
- Click Create Volume.
- Select the volume type, size, and Availability Zone.
- Attach the volume to an EC2 instance in the same Availability Zone.
- Connect to the instance and configure the disk.
Once attached, you need to format and mount the volume before using it.
Example Linux commands:
# Check available diskslsblk
# Create an ext4 filesystemsudo mkfs -t ext4 /dev/nvme1n1
# Create a mount directorysudo mkdir /data
# Mount the volumesudo mount /dev/nvme1n1 /data
# Verify the mounted volumedf -hImportant:
- On Nitro-based instances, EBS volumes usually appear as NVMe devices, such as
/dev/nvme1n1. Other instances may use names such as/dev/xvdf.
- Never run
mkfson a volume containing data you want to preserve. It creates a new filesystem and can erase existing data.
- The mount will not automatically survive a reboot unless you configure
/etc/fstab.
To make mounting persistent, first find the filesystem UUID:
sudo blkid /dev/nvme1n1Then add the UUID and mount point to
/etc/fstab :UUID=<your-filesystem-uuid> /data ext4 defaults,nofail 0 2Using UUIDs is preferable to device names because device names can change after reboot.
4. EBS Snapshots: Backing Up Your Data
What happens if your application data gets deleted or corrupted?
This is where EBS snapshots become useful.
An EBS snapshot is a point-in-time backup of an EBS volume stored in AWS-managed storage.
Important features:
- The first snapshot is a full snapshot; subsequent snapshots are incremental.
- Only changed and new blocks need to be stored in subsequent snapshots.
- You can restore a volume from a snapshot.
- Snapshots are stored regionally, so you can create a volume from a snapshot in any Availability Zone within that Region.
- You can also copy snapshots to other AWS Regions.
- You can automate snapshot creation and retention using Amazon Data Lifecycle Manager.
Example:
Suppose your first snapshot contains 20 GB of data. Later, 5 GB of blocks change. The next snapshot stores the changed blocks rather than duplicating the entire backup.
A few additional things worth knowing:
- Deleting an older snapshot does not break newer snapshots. AWS preserves data blocks still referenced by other snapshots.
- Volumes restored from snapshots may experience slower first reads because data is loaded lazily. Fast Snapshot Restore (FSR) helps eliminate this initial initialization delay.
- AWS does not automatically back up your EBS data. You need to configure snapshots or an automated backup solution.
You can create snapshots through the EC2 Console:
EC2 → Elastic Block Store → Volumes → Select Volume → Actions → Create Snapshot.

5. EBS Multi-Attach: One Volume, Multiple EC2 Instances
Usually, an EBS volume is attached to one EC2 instance at a time.
However, AWS offers a feature called EBS Multi-Attach, which allows an eligible EBS volume to be attached to multiple EC2 instances simultaneously.
Why is this useful?
Imagine multiple EC2 instances in a clustered application that need access to the same shared block storage.
Multi-Attach supports this type of architecture.
Important things to remember:
- Supported with io1 and io2 volumes.
- Instances must be Nitro-based and in the same Availability Zone.
- Up to 16 instances can be attached to an eligible volume.
- Applications must coordinate concurrent writes.
- A regular filesystem should not be assumed safe for simultaneous writes from multiple instances.
Multi-Attach is useful for specialized clustered applications, but it is not a replacement for shared file storage such as EFS.
6. EBS Encryption: Keeping Your Data Secure
Storage security is just as important as storage performance.
Amazon EBS supports encryption using AWS Key Management Service (AWS KMS).
EBS encryption helps protect:
- Data stored on EBS volumes.
- Data transferred between EC2 instances and EBS.
- EBS snapshots.
- Volumes created from encrypted snapshots.
You can use AWS-managed KMS keys or customer-managed KMS keys.
How to enable encryption:
- Open the EC2 Dashboard.
- Go to Settings under EBS.
- Enable encryption by default.
- Select your preferred KMS key.
New EBS volumes and snapshots created in that Region will use encryption by default, subject to the applicable configuration.
Remember: You cannot directly enable encryption on an existing unencrypted volume. You can create a snapshot and use it to create an encrypted copy or volume.
7. EBS vs EFS: What's the Difference?
Both EBS and EFS provide storage in AWS, but they serve different purposes.
Feature | EBS | EFS |
|---|---|---|
Storage type | Block storage | File storage |
Access | Typically one EC2 instance | Multiple instances |
Scope | Availability Zone | Regional, multiple AZs |
Scaling | Provisioned capacity | Elastic scaling |
Protocol | Block device | NFS |
Typical use | Databases, boot volumes | Shared files, web content |
Client support | Depends on OS and filesystem | Linux-based NFS clients |
When should you use EBS?
When an EC2 instance needs persistent block storage for its operating system, database, or application data.
When should you use EFS?
When multiple EC2 instances need to access the same shared file system.
For example, if multiple Linux web servers need access to the same uploaded files, EFS can be a suitable choice.
Remember that EBS Multi-Attach is a specialized exception to the usual single-instance access pattern.
8. Modifying and Monitoring EBS Volumes
Your storage requirements may change as your application grows. AWS allows you to modify EBS volumes using Elastic Volumes.
You can:
- Increase volume size.
- Change volume type, such as gp2 to gp3.
- Increase or decrease supported performance settings.
But there is something important: Increasing the EBS volume size does not automatically expand the partition and filesystem inside Linux.
The commands depend on how the filesystem was created.
Case 1: Filesystem directly on the device (as in Section 3)
# For ext4sudo resize2fs /dev/nvme1n1
# For XFSsudo xfs_growfs /dataCase 2: Filesystem created on a partition (common with root volumes)
# Extend the partitionsudo growpart /dev/nvme0n1 1
# For ext4sudo resize2fs /dev/nvme0n1p1
# For XFSsudo xfs_growfs /The exact device names and partition numbers may vary depending on your instance.
Monitoring EBS performance
Amazon CloudWatch helps monitor EBS performance through metrics such as:
- VolumeReadOps and VolumeWriteOps.
- VolumeReadBytes and VolumeWriteBytes.
- VolumeQueueLength.
- VolumeThroughputPercentage (where applicable).
These metrics help identify performance bottlenecks.
A useful operational note: You cannot shrink an EBS volume in place. A previous modification must reach the
completed state before another modification can be initiated. AWS currently allows up to four modifications per volume in a rolling 24-hour period. Always check the latest AWS documentation for modification limits.9. Common EBS Mistakes to Avoid
A few things worth remembering when working with EBS:
- Creating a volume in a different Availability Zone from the EC2 instance.
- Forgetting to configure
/etc/fstabfor persistent mounting.
- Deleting an instance without checking
DeleteOnTermination. It is typically enabled by default for root volumes and disabled for additional volumes, but always verify the setting.
- Assuming snapshots are always application-consistent.
- Attaching a Multi-Attach volume without proper filesystem coordination.
- Forgetting to expand the filesystem after resizing a volume.
- Keeping unused volumes and snapshots indefinitely.
One more useful tip: If you need to move an EBS volume to another Availability Zone or Region, create a snapshot and then create a new volume from that snapshot in the destination location. For another Region, copy the snapshot there first.
Quick Revision Cheat Sheet
Question | Answer |
|---|---|
Best general-purpose EBS volume? | gp3 |
High-performance database storage? | io2 |
Can st1/sc1 be boot volumes? | No |
Can EBS attach to multiple instances? | Yes, with eligible Multi-Attach volumes |
Are snapshots incremental? | First is full; subsequent ones are incremental |
How do you encrypt an existing unencrypted volume? | Snapshot and create an encrypted copy |
Can you shrink an EBS volume? | No, not in place |
Which service provides shared file storage? | EFS |
Conclusion
Choosing the right AWS storage service depends on the workload:
- gp3: General-purpose applications and databases.
- io2: High-performance, I/O-intensive workloads.
- st1/sc1: Large, sequential data workloads.
- EBS: Persistent block storage for EC2.
- EFS: Shared, elastic file storage across multiple Availability Zones.
Understanding these differences helps you design storage that balances performance, availability, security, and cost.
Let's discuss:
Have you used EBS snapshots or Multi-Attach in a real project? And in what scenario would you choose EFS over EBS?
I'd love to hear your experiences and learn how others approach storage in AWS.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article