How to Attach AWS EBS Volume to AWS EC2 Instances

On some cases we may need to add additional new EBS volume to a EC2 instances. This post will help you with how to add or attach additional AWS EBS Volume to running AWS EC2 Instances..


How to Attach AWS EBS Volume to AWS EC2 Instances


End of the post, you would be able to understand,

1. How to create new AWS EBS volume?
2. How to attach AWS EBS volume to any running EC2 instances?
3. How to create filesystem on AWS EBS volume?
4. How to mount AWS EBS volume on EC2 instances?


Also You can watch this tutorial demo video on our YouTube Channel.

"How to Attach AWS EBS Volume to AWS EC2 Instances"

How to Attach AWS EBS Volume to AWS EC2 Instances


Step 1: Select correct EC2 instance

Make sure you have selected the correct EC2 instances to which we are going to add additional or new aws EBS volume.

How to Attach AWS EBS Volume to AWS EC2 Instances

Step 2: Identify AWS Availability Zone

Go to storage section, find how many EBS volumes have been attached to aws EC2.

How to Attach AWS EBS Volume to AWS EC2 Instances

So primarily you'll be having a root EBS volume and also identify the availability zone of EC2 instance where it is running.

How to Attach AWS EBS Volume to AWS EC2 Instances

We can attach multiple aws EBS volumes to a single instances but the volumes we create and the instance must be in the same availability zone.

Step 3: Create new AWS EBS Volume

Go to volumes and Click on Create volume.

How to Attach AWS EBS Volume to AWS EC2 Instances

Specify new AWS EBS Volume details like Volume type, size, IOPS, Throughput, Availability Zone and other info as you prefered. Dont forget to select the right availability zone of our EC2 is running.

How to Attach AWS EBS Volume to AWS EC2 Instances

Once you entered all details, just click on create volume.

How to Attach AWS EBS Volume to AWS EC2 Instances

 This will generate new Volume id for newly created AWS EBS Volume.
 

How to Attach AWS EBS Volume to AWS EC2 Instances

Go to volumes again to verify the state of newly created AWS EBS Volume. it should be in 'available' state for now.

How to Attach AWS EBS Volume to AWS EC2 Instances


Step 4: Attach new AWS EBS Volume

Go to actions, Click on Attach volume.

How to Attach AWS EBS Volume to AWS EC2 Instances


Search for the instance with name or instance id. Finally click on attach to proceed further.


How to Attach AWS EBS Volume to AWS EC2 Instances

Note: Volume Status will be changed from "Available" to "In Use".

Step 5: Create filesystem & mount AWS EBS Volume on AWS EC2

Login into EC2 instance and find the new device id that is created by OS kernel using "fdisk -l" or "lsblk" commands.

sudo lsblk
sudo fdisk -l

How to Attach AWS EBS Volume to AWS EC2 Instances


In order to mount this volume we have to create a file system. Lets create a xfs file system type on this EBS volume.

sudo mkfs.xfs /dev/xvdf

How to Attach AWS EBS Volume to AWS EC2 Instances

Mount volume on a target directory using mount command.

sudo mount /dev/xvdf /mnt

How to Attach AWS EBS Volume to AWS EC2 Instances

Hope this post helped you with How to Attach AWS EBS Volume to AWS EC2 Instances. Keep practicing and have fun. Leave your comments if any.

Also Request you to go through the below recommended tutorial, if you are interested in learning.


Keep practicing and have fun. Leave your comments if any.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.

إرسال تعليق

0 تعليقات