🚀 Day 13: EBS in AWS :create and attach your volume

Sumith S RaikarSumith S Raikar
2 min read

First, What is EBS?

EBS is like a virtual hard disk that you can attach to your EC2 instance. The best part? It keeps your data safe even if the instance stops or gets terminated — unless you delete it yourself.

Here’s why people love EBS:

  • It's persistent.

  • You can scale it anytime.

  • You can easily back it up.

  • It comes in different performance types.


What You Need Before You Start

  • An AWS account

  • One running EC2 instance (Linux preferred for this guide)


Step-by-Step: Creating and Attaching an EBS Volume

1. Head to the EC2 Dashboard

  • Log in to your AWS console.

  • Go to the EC2 service.

  • On the left-hand menu, scroll down to Elastic Block Store → Volumes.


2. Create a New Volume

  • Click on Create Volume.

  • Choose a volume type (I recommend gp3 for most use cases).

  • Set the size (8 GiB is good to start).

  • Important: Make sure you select the same Availability Zone as your EC2 instance (like us-east-1a).

  • Click Create Volume.


3. Attach the Volume to Your EC2 Instance

  • Find your new volume in the list and select it.

  • Click Actions → Attach Volume.

  • Pick your EC2 instance from the dropdown list.

  • Use a device name like /dev/xvdf and confirm.


🖥️ Step 4: Format and Mount the EBS Volume (on Linux)

Connect to your instance via : ssh -i your-key.pem ec2-user@<your-public-ip>

Check the attached disk: lsblk

You should see /dev/xvdf listed.

Format the new volume: sudo mkfs -t ext4 /dev/xvdf

Create a directory to mount it: sudo mkdir /data

Mount it: sudo mount /dev/xvdf /data

Now check if it’s mounted: df -h

thank yoou

0
Subscribe to my newsletter

Read articles from Sumith S Raikar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sumith S Raikar
Sumith S Raikar