DEV Community

Nishita Mohanty
Nishita Mohanty

Posted on

How to attach a volume to an instance of different availability zone?

So, when we want to attach a volume of different availability zone to an instance then the concept of SNAPSHOT comes into the picture.
Suppose you have an instance, in ap-south-1a availability zone.!

Image description

Now, suppose you have a volume of 15GB in different availability zone let it be in ap-south-1b.

Image description

Then go the volume(which you want to attach) -> go to actions -> create snapshot -> add a description -> add tag (value = description name)-> create snapshot.

Image description

Image description

Now, go to Snapshots you will find that a snapshot of your volume is being created.

Now, we need to create volume from the snapshot.
So, go to actions -> click on create volume from snapshot -> give size according to your wish -> change the availability zone according to the instance with which you want to attach the volume -> Give tag -> Create volume.

Image description

Image description

Image description

Now, go to volumes you will find a new volume is created.

Image description

Now, you can add the new volume to your instance by following the below steps.
Step 1: Go to Xshell then type sudo su then type lsblk

We will fing a 8G volume is mounted into the root (/).

Image description

Step 2: Then we need to add the volume to our instance so, go to
your AWS console and then go to the volume section. Click on the volume you want to attach to your instance then go to actions -> click on attach volume, then follow the below steps.

Image description

Image description

Image description

Image description

Step 3: Then go to Xshell, type lsblk, it will show that the
extra volume is attached to the instance.

Image description

Now, type df -h, we will find that the new volume is not showing on the instance details which means the new volume is attached but not mounted into the instance.

Image description

So, to mount the volume here are the following steps:
Step1 : Type mkdir /india (making a directory)
Step2 : Type cd /india (changing directory)

Image description

Then type mount /dev/xvdf /india/. Now, our EBS volume is mounted on our AWS instance.
We can also check it by typing df -h, then we will see the 15G storage used in the our directory India.

Image description

This is the whole process by which you can connect the volume and instance of different availability zones.

Top comments (0)