What is Block Storage in Cloud Computing ?
Block Storage is a type of storage technique sometimes known as Block-level storage. This breaks up data into blocks and then stores those blocks as separate pieces.
We already discussed a service EBS on the AWS that provides storage to us and our instance uses that storage to boot up and store its data. Whatever we are using in EC2 to launch our instance on EBS volume that is Block storage. We can make partitions on block storage and that’s why we are able to launch an instance on that storage.
Mainly Storage is of three types:
All have some different functionality. Today we are going to discuss only the block storage. Block storage is divided into two different groups:
Ephemeral block storage is that storage which on terminated data is wiped. It is similar to our C drive on the computer. If we have to change our OS for any reason first we have to take the backup of all of our files. Because once we flush the os all the data will be erased.
The data of our pen drive or hard disk doesn’t go away, It is always permanent until you delete that on your self own. This is the reason it is known as persistent storage.
This means whatever the instance we are going to launch in AWS the data will be wiped once we terminated it. But sometimes the data is very crucial and we want that even after the termination we would be able to access our data. Now the question is how we can achieve persistent storage and can access our older data even after the termination of the instance.
How we can achieve persistent storage
In AWS we can create an extra volume like a pen drive through EBS and We can attach that pen drive to our instance and mount it with the folder where we are going to paste our data that we want permanent.
Now in the future, if the instance got deleted, we don’t have to worry about the data that will be saved in our extra EBS volume and we can easily access that again mounting it with any instance.
Here is the process you can achieve this:
- Create an EC2 instance.
- Create an EBS volume.
- Attach that volume with the above instance.
We already know how to launch an instance in case if you don’t have any idea you can go through this link.
Step to launch EBS volume
I am expecting that you have launched your instance successfully. Inside EC2 service left bottom there is a service Elastic Block Storage
Click on the volumes. There you will find one volume is already created and that is the exact volume which is attached with your instance. When you will terminate the instance this volume will also get deleted.
You want a separate volume that you will attach with your instance. To create a new EBS volume, simply click on Create Volume.
In the very first option, you can select the type of volume based on their speed of data processing. I am using a default type of gp2 storage. Select the size you want. You can create a minimum of 1 GiB to a maximum of 16384 GiB space volume. One thing is important to notice that the EBS service is a region-based service. What I mean by region based service is that what we can do in EBS is applicable for only one region. For another region, we have to configure that again. There are some other services that are global.
Now the question is where to put our volume, in 1a, 1b, or 1c?
You want to use this volume for your launched instance so you have to launch your volume into the same availability zone in which the instance is.
How to know the availability zone of your instance?
Very easy, just go to your EC2 dashboard, click on running instances, and select your instance, and below at the bottom, you will see there will some details about your instance. And there you will find the availability zone of your instance. Select the same availability zone and finally click on create volume.
Now close this and come to your volumes section. You will see there is one more volume is come up. Because you have successfully created one volume. In the status section, you will see the available message is visible.
Now click on the action and choose to attach volume option there.
Select the instance id from your instance description(you can get the instance id by following the same step as you have done for availability zone). Now finally click on attach volume.
All done. You have successfully set a setup where even after termination of your instance your data will be safe. You can confirm this successful attachment by looking at this below detail.
Hope you have learned something new today. If there any query you can ask me in the comment. Don’t forget to follow our social media handles for future updates.