How to Create Elastic Block Storage(EBS) Volume on AWS

To Create Elastic Block Storage(EBS) Volume on AWS

Introduction:

The EBS is the Elastic Block Storage. The main purpose of EBS is Data Resistance. If you creating one EC2 Instance using Block storage and if you reboot or start/stop your EC2 machine, then data from EC2 machines will not be lost. We can use minimum storage of 1 GiB to 16 TiB. If you creating one EC2 machine using Instance Storage and if you reboot or start/stop your EC2 machine, then data from EC2 machines will be lost. This tutorial will cover creating EBS volume on AWS.

Types of EBS Volume:

General Purpose(SSD): It’s used for General purpose usage without specific requirements. Provisioned IOPS(SSD): When you required really fast input and Outputs you can choose this. Throughput Optimized (HDD): Magnetic drive optimized for quick throughput. Cold HDD: Lowest cost HDD volumes for frequently access workloads. Now we will create the EBS volumes on AWS. First Open AWS console, This the console of AWS and click sign to enter your Account. Here enter your credentials to enter the account This is the dashboard of AWS and click service and click EC2 to create a Instance This is the dashboard of EC2 and click Launch Instance to create a Instance Here you can select the Instance machine, I am select Amazon Linux 2 AMI Then choose the Instance type, by default AWS refers 2t.micro I am leave is as default. After that you will enter into configure instance details tab Here you can configure the Instance requirements as your wish I leaving it by default and hit add storage Here I will add new EBS volume for the instance and hit add tags. After that click the Add Tag option, This is used to identify the instance and billing details of the EC2 instance and click configure security group Here you have put Group name and Description name. Finally click the review Tab it will show what you are configured on your instance and click launch This is the important part of the instance creation, here you have to create key pair its used to take control of your instance via SSH, here I am using my existing key pair and click launch instance

The instance is launch now click the view instance to view the instances The instance is created and running and you can see the details about the instance Now go to Elastic Block store volume and here you can see the EBS volumes Now I will show you how to take control of the ec2 instance by using ssh for the first open the download location of your system then right click on the window and click Git bash here

Here GIT is mandatory for take control of the instance using SSH

Here I will take control of the instance by using following command

ssh -I LinuxEBSdem.pem ec2-user@13.237.251.17

Now I will show you how to attach, detach and delete the volumes form the instance for that first I check the drives

[ec2-user@ip-172-31-43-41 ~]$ lsblk

Now I will add the drive to the machine for that first I format the disk to ext4 fomat

[ec2-user@ip-172-31-43-41 ~]$ sudo mkfs.ext4 /dev/svdb

Now I will create directory for mount the drive

[ec2-user@ip-172-31-43-41 ~]$ mkdir demo

Now I will create a file and edit the file to the directory

[ec2-user@ip-172-31-43-41 ~]$ sudo touch test.txt
[ec2-user@ip-172-31-43-41 ~]$ sudo vim test.txt

Now I will mount the drive to the directory

[ec2-user@ip-172-31-43-41 ~]$ sudo mount /dev/svdb demo/

The drive is mounted now the check the drive by executing following command

[ec2-user@ip-172-31-43-41 ~]$ lsblk

Now I am unmount the drive from the machine using following command

[ec2-user@ip-172-31-43-41 ~]$ sudo umount demo/

Now I will show you how to detach and delete and attach the volume to the instance machine, for that enter into elastic block store volume to AWS console Now I will detach the EBS add volume for that first select the volume and click the action tab and click detach volume and click ok to detach Here you can see the status of the Volume if available that means the volume is detached successfully now check the instance on ssh

Now I will show how to attach the existing volume to the instance machine for that select the volume and click action bar and click attach volume option and select the instance name and select the device name here I am select the device name is xvdd and click attach Now check the terminal if the volume is successfully added

[ec2-user@ip-172-31-43-41 ~]$ lsblk

Now I will show how to delete the EBS volume for that first select the volume which you want to delete then detach volume and click the action tab and click delete volume and click ok to delete the volume There you can see the volume is deleted With this method to Create EBS volume on AWS is comes to an end.

FAQ
Q
What is the advantage of EBS?
A
If you are terminate your Instace it will delete only the root volume.The EBS volume is cannot delete until you delete it manually.
Q
What is the disadvantage of EBS?
A
If you are increase your EBS volume then you cannot decrease your volume size.
Q
What are the minimum and maximum storage size of EBS?
A
The minimum size 1 GiB and the maximum size is 16 TiB.
Q
What is the purpose of EBS?
A
The purpose of Elastic Block Storage is data resistance.
Q
What is the expansion of EBS?
A
The EBS defines Elastic Block Storage.