Everything You Need to Know About AWS EBS (with Hands-on)

Hello, I’m Som, a DevOps Engineer passionate about streamlining operations through automation, continuous integration, and deployment. I am deeply passionate about exploring new technologies and continuously expanding my knowledge in the ever-evolving world of IT.
In this blog, we’ll dive deep into one of the most important storage services in AWS — Elastic Block Store (EBS).
By the end of this guide, you’ll not only understand what EBS is, but you’ll also create, attach, expand, take backups, and restore data between EC2 instances using snapshots.
Whether you’re a learner or an aspiring DevOps engineer, this hands-on guide will help you understand how EBS is used in the real world.
☁️ What is AWS EBS?
EBS stands for Elastic Block Store — it’s a persistent block storage service designed for use with Amazon EC2 instances.
Think of EBS as a virtual hard drive for your EC2 instances. It stores your data permanently (even after you stop or terminate your instance, if the volume is detached or backed up).
Each EBS volume is automatically replicated within its Availability Zone to protect you from hardware failures.
⚙️ Why EBS Matters
EBS volumes are essential in real-world projects because they:
Store databases, application files, or logs persistently
Allow you to scale storage dynamically
Let you back up data using snapshots
Enable disaster recovery by restoring snapshots to new instances
🧩 Step 1: Create an EC2 Instance
First, we’ll create an EC2 instance to attach our EBS volume to.
Go to AWS Console → EC2 → Instances → Launch Instance
Choose Ubuntu or any other image you’re comfortable.
Select instance type (e.g.,
t2.micro)Configure key pair & security group
Launch the instance

- Connect to the instance and check the default disk space
8G

- This is the default EBS volume which is created along with the ec2 instance and will store your data.

🧩 Step 2: Create and Attach an EBS Volume
Go to EC2 → Elastic Block Store → Volumes → Create Volume
Choose:
Volume type: gp3 (SSD)
Size: 20 GB
Availability Zone: same as your EC2 instance (ap-south-1a)
Click Create Volume

Once created, give it a name, select it→ Actions → Attach Volume
Select your EC2 instance
Device name:
/dev/sdk( You can choose any one you like)



Done! Your new EBS volume is now attached to your instance.
🧩Step 3: Mount and Use the EBS Volume
Now we’ll make the volume usable inside the EC2 instance. SSH into the instance and list the block devices lsblk

- Check disk partition -
sudo fdisk -l. It shows the path of disk volume, use it to check the file system of the EBS volume

- To check the filesystem run -
sudo file -s (path)

If the output is data then it means no file system is created for this EBS vloume and we need to create the file system for the EBS and later we have to mount it.
Command to make the file system -
sudo mkfs -t xfs /dev/nvme1n1( use your disk path)

- Let’s check the output of the file system again

- Previously it was showing the data but now it’s changed to the filesystem. What’s next? We did pretty much everything what’s left is to mount this volume to the directory. Let’s create a directory and mount it to our EBS volume.

- Directory is created let’s mount it now ( Command -
sudo mount [path-of-ebs] [path-of-directory])

- There’s one more command to check that the volume is in use (
df -h)

- As you can see from the 20G 425M is used, volume is in use now.
🧩Step 4: Increase the EBS Volume Size
Note: You can only increase the volume but you can not decrease it
In real-world scenarios, applications grow — so you’ll need to expand your storage.
Go to EC2 → Volumes → Modify Volume

Increase size (e.g., from 20 GB → 25 GB)

Click Modify → Yes
Wait for some minutes after you modify it. When it’s modified run -
lsblkto recheck the volume size
Volume size is increased. Are we done ? No, here’s a twist your volume size does got increased but but but your file system size which you defined previously as 20G is still 20G. How to check it? Use
df -h
Well are we stuck ? No, here’s a simple and easy command to resize it ( -
sudo xfs_growfs filesystem-name).
It’s done. Let’s more forward to the next part
🧩Step 5: Taking the snapshot of the data and attaching it to the another EC2 instance
Let’s first insert some data in the EBS and then we will take the snapshot of the EBS in short the data present in the EBS volume. Snapshot is the backup of the data. So if you want to backup some data in the snapshot make sure you have everything present cause snapshot will only backup the data which is present in the real time so we aware. After the snapshot is taken and the EBS volume is getting more data it won’t be saved.
- First I’ll go in the directory
/ebsvolumewhere we mounted our EBS volume and will create some files there

We created 2 demo files now let’s create another ec2 instance and then we will take the snapshot and attach it with the new ec2 instance
Created Dev-2 ( new ec2 instance)

- Let’s move ahead and take the snapshot from the volume. Volumes → Select your volume → Actions → Create Snapshot



Now you have a backup that you can use later to restore data or migrate to another instance.
Snapshot is created but we have to create the volume from the snapshot in order to attach it with the EC2 instance so let's do it.
Go to Snapshots → Select Snapshot → Actions → Create Volume ( Use the same or new Availability Zone and Keep size ≥ original )


- Created the volume you can rename it whatever you want
- Now do the same attach process we did previously with the Dev-1 attach this vol to the newly created EC2 instance


- It’s attached let’s verify from the console
- If you check the filesystem in the EBS it’s already there cuz we created it in the dev-1 vol the only thing left is to mount it


- Now the mount is complete. Let’s check if the data from the dev-1 vol is there or not.

The same data (demo1.txt, demo2.txt) appears here too!
You’ve successfully backed up and restored data using AWS EBS snapshots.
Note: If you create any new files in the dev-1 it won’t be reflected in the dev-2
Blog Summary
In this blog, I explored everything you need to know about AWS EBS (Elastic Block Store) — from understanding how it works to hands-on implementation. I covered creating and attaching EBS volumes to EC2 instances, resizing storage, taking snapshots for backups, and restoring them in another EC2 instance. Perfect for anyone looking to get real, practical AWS experience!



