How to attach an EBS volume to EC2 (Linux)?

This blog would cover what is EBS volume and how could we add an additional EBS volume to an EC2 instance in AWS cloud.

What is EBS (Elastic Block Storage)?

AWS EBS is a block level storage service that could be attached mainly with EC2 instance and database instance.

Its mainly designed for both throughput and transaction intensive workloads with Amazon EC2. Also RDS & Non RDS, other file systems uses EBS as storage device. You could choose EBS volume type based on your IOPS or throughput requirement.The scalability of EBS storage works better within an Availability Zone.

The EBS provides different types of volume such as general purpose (gp2), provisioned IOPS (io1), throughput optimized HDD (st1) and cold HDD (sc1). The EBS volume type are mainly categorized into two types 1. EBS SSD-backed 2. EBS HDD-backed.

The best use cases for SSD are on top of EC2, Relational database and NoSQL database and as that of HDD for Hadoop, Data warehousing, Transcoding, Encoding etc.

Key Points

  • EBS Volume are created in specific Availability Zone and could be attached to the instance which resides in same AZ.
  • EBS volumes are persistent and independent of EC2
  • EBS offers detach and attach volume service within same AZ
  • One EBS volume could be attached to one EC2 at a time
  • Multiple EBS could be attached to the same EC2
  • An EC2 instance could have separate EBS boot and data volume
  • You could create Snapshot from EBS volume for backup purposes
  • AWS EBS also support data encryption at rest

Benefits of using EBS

  • Secure
  • High Available and Durable
  • Performance
  • Unlimited Scale
  • Cost Effective

In below section, we would add an additional EBS volume type to an instance

1.Verify the Current EBS type. In this case, there is only one volume type (/dev/sda1) as boot data to the instance below

2. Go to Volumes and then click on Create Volume

3. Select Volume Type as General Purpose SSD (gp2). The Size ranges from 1 GiB to 16384 GiB. Select 1 GiB for this demonstration

Select Availability Zone for your new EBS volume as same as that of your EC2 AZ. Here we would select us-east-1d as the EC2 also reside in this AZ

Add a tag name to your EBS volume for identification

Click on Create Volume. The state would be in Available once the volume is created

4. Select the Volume and then go to Action and select Attach Volume

5. Provide the Instance Id where you want to add the new volume and device type (/dev/sdf). The Linux device type varies from /dev/sdf to /dev/sdp. That means your first instance data volume type would be /dev/sdf and next data volume would be /dev/sdg and vice versa

6. Click on Attach. The volume state would be changed from Available to In-Use

7. Verify the volume type from console as well as from EC2 login terminal

Login to EC2 and verify the volume devices

In next blog, we would discuss how to mount a EBS volume drive in AWS

The EBS volume provides better data availability, data persistent, data encryption & backup as compared to the traditional physical storage. I hope this blog helps. Please comment if you have any questions/concerns related to this blog.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: