What is Elastic Block Store (EBS) and How Does It Work?

Basically in AWS there are three types of storage solution

  1. Block Storage (EBS)
  • EBS stand for ELASTIC BLOCK STORE

  • Best example is Pen drive because EBS is used when EC2 instance is launched in same availability zone as ebs is created.

  1. File Storage (EFS)
  • EFS stands for ELASTIC FILE SYSTEM
  1. Object Storage (S3)
  • S3 stands for Simple Storage Service

Definition

Elastic Block Store(EBS) is a cloud-based storage service provided by Amazon Web Services (AWS). EBS provides persistent block storage volumes that can be attached to Amazon EC2 instances. These storage volumes function like traditional hard drives, enabling data to be stored and retrieved as needed. Key features include durability, high availability, flexibility, and support for various performance and cost options. EBS is commonly used for applications requiring reliable and scalable storage solutions, such as databases and enterprise applications.

STEPS TO CREATE EBS VOLUME :-

  1. Go to EC2 Dashboard.

  2. In left side you can Elastic Block Store, Click on Volumes.

  3. Click on create Volume

  4. Select default Volume type, select size of ebs Volume. for example i will set it as 1 GiB.

  5. Select Availability Zone. for example ap-south-1a.

  6. remaining set it as default and Click on Create volume.

CREATE EC2 INSTANCE :-

  1. Go to instances.

  2. click on Launch instances

  3. Enter the name of instance i.e., ebs-server

  4. select Key pair

  5. go to Network setting and select subnet AZ has ap-south-1a i.e., the Availability zone must be same as ebs volume.

  6. remaining set it as default and Click on Launch instance.

ATTACHING EBS Volume to EC2 Instance :-

  • Go to ebs volume and select the volume.

  • go to Actions and click on Attach volume.

  • In Attach volume, Select instance and Device name.

  • Click on Attach volume.

  • Go to EC2 instance and connect.

In terminal go to root user. i.e., sudo su.

Run this command

  • df -h (Details of Connected hard disk)

  • lsblk (To check all hdd i.e., hard disk details for mounting i.e., LIST OF BLOCK)

  • file -s /dev/volume_name (To check File System)

  • mkfs -t ext3 /dev/volume_name (To create ext3 file system)

  • file -s /dev/volume_name (To check File System again)

  • mkdir file_name (To create directory to mount volume)

  • mount /dev/volume_name /location_where_it_should_mount (command to Mount the EBS volume to the directory).

  • umount /location_of_directory ex:- umount /home/ec2-user/my-data. (To un mount the EBS volume from directory).

Step-by-Step process to attach the ebs volume to ec2-instance.

  1. df -h

  2. lsblk (it will display list of block, for example we will consider our volume name is xvdb)

  3. file -s /dev/xvdb

  4. mkfs -t ext3 /dev/xvdb

  5. file -s /dev/xvdb

  6. mkdir my-data

  7. mount /dev/xvdb /home/ec2-user/my-data.

I'm excited to share my first blog post with you. If you see any mistakes or have ideas for improvement, please share them in the comments!