What is Elastic Block Store (EBS) and How Does It Work?
Table of contents
Basically in AWS there are three types of storage solution
- 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.
- File Storage (EFS)
- EFS stands for ELASTIC FILE SYSTEM
- 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 :-
Go to EC2 Dashboard.
In left side you can Elastic Block Store, Click on Volumes.
Click on create Volume
Select default Volume type, select size of ebs Volume. for example i will set it as 1 GiB.
Select Availability Zone. for example ap-south-1a.
remaining set it as default and Click on Create volume.
CREATE EC2 INSTANCE :-
Go to instances.
click on Launch instances
Enter the name of instance i.e., ebs-server
select Key pair
go to Network setting and select subnet AZ has ap-south-1a i.e., the Availability zone must be same as ebs volume.
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.
df -h
lsblk (it will display list of block, for example we will consider our volume name is xvdb)
file -s /dev/xvdb
mkfs -t ext3 /dev/xvdb
file -s /dev/xvdb
mkdir my-data
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!
Subscribe to my newsletter
Read articles from Syed Fahaduddin directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Syed Fahaduddin
Syed Fahaduddin
I am a recent graduate with practical experience in AWS services including EC2, S3, and RDS. I’m passionate about cloud computing and excited to bring my skills to a forward-thinking team. Committed to continuous learning and staying current with emerging cloud technologies.