Amazon storage has different types of memory solutions. You can choose depending on your project and requirement. One such storage option is Amazon Elastic Block Store. Amazon Elastic Block Store is needed to store persistent data. It is attached to EC2 instances for additional storage. 

On that note, let’s take a look at the features and operations of Amazon EBS, including how to create and delete volumes. 

What is AWS Elastic Block Store (EBS)? 

Elastic Block Store (EBS) is a storage device that can be attached to an EC2 instance. This storage device is block-level storage with high durability. 

These are raw, unformatted block devices that can be mounted on any running instance. These are independent of the storage we add while setting up an EC2 instance. 

What Are the Features of Amazon Elastic Block Store? 

  1. It can be created in any Availability Zone and attached to an instance in the same Availability Zone (AZ). 
  2. Snapshots of storage can be taken into S3, restored to other Availability Zones, and attached to instances in that particular AZ. 
  3. You can encrypt it for higher data security. 
  4. Provides different types of volumes, namely:  
  • General Purpose SSD volumes (gp2 and gp3): Balanced disk 
  • Provisioned IOPS SSD volumes (io1 and io2): Highly scalable, High Performance, High cost, Supports Multi Attach (AWS/EBS-Operations-and Advantages#multi-attach-volumes). 
  • Throughput Optimised HDD volumes (st1): Low cost, ideal for the large, sequential workload. 
  • Cold HDD volumes (sc1): Low cost, suitable for users with fewer IOPS. 

What Are Multi Attach Volumes? 

Multi-Attach enabled volumes can be attached to up to 16 Linux instances in the same AZ. This feature is available only for IO2 volumes in all regions. IO1 is limited to a few regions. 

Multi Attach devices cannot be added as boot devices. 

Multi Attach volumes can be attached to Windows instances. However, the operating system cannot recognize the shared data across instances, which would result in data inconsistency. 

Moreover, it cannot be provisioned as Boot volumes. Standard file systems like EXT4/XFS cannot be used for Multi attach volumes as data is accessed simultaneously from different servers. Instead, a clustered file system can provide better data consistency. 

Creating an Amazon EBS Volume 

Follow these steps and create an Amazon EBS Volume. 

Step 1: Select Volumes from Elastic Block Store under EC2 and click Create Volume.

Step 2: Select the desired type of storage as per requirement. For Multi Attach (AWS/EBS-Operations-and-Advantages#multi-attach-volumes) enabled volumes, Select Provisioned IOPS SSD volumes (io2). 

Selecting the type of storage. 

Step 3:  Fill in all other details as required (check Multi Attach (AWS/EBS-Operations-and Advantages#multi-attach-volumes), if you like to enable it).

Enabling Multi-Attach

Step 4: Click on Create Volume. Once the Volume is initialised, it can be attached to any running EC2 instances in the same region. 

Creating Amazon EBS volumes from AWS CLI 

Here are the steps of creating Amazon EBS via the command line. 

Step 1: Create General Purpose SSD volumes (gp2). 

aws ec2 create-volume –volume-type gp2 –size 10 –availability-zone ap-south 1a

OUTPUT:

{ “AvailabilityZone”: “ap-south-1a”, “CreateTime”: “2021-05-15T18:19:09+00:00”, “Encrypted”: false, “Size”: 10, “SnapshotId”: “”, “State”: “creating”, “VolumeId”: “vol-0a29faaf3b0eb6966”, “Iops”: 100, “Tags”: [], “VolumeType”: “gp2”, “MultiAttachEnabled”: false }

Step 2: Create Provisioned IOPS SSD volumes (io2). For IOPS devices, we need to specify values for IOPS and snapshot-id. 

aws ec2 create-volume –volume-type io2 –iops 1000 –snapshot-id snap-136ecefa –availability-zone ap-south-1a

OUTPUT : 

{ “AvailabilityZone”: “ap-south-1a”, “CreateTime”: “2021-05-15T18:29:35+00:00”, “Encrypted”: false, “Size”: 8, “SnapshotId”: “snap-136ecefa”, “State”: “creating”, “VolumeId”: “vol-03ab372122136d9cb”, “Iops”: 1000, “Tags”: [], “VolumeType”: “io2”, “MultiAttachEnabled”: false }

Step 3: Create a volume with Multi Attach (AWS/EBS-Operations-and-Advantages#multi-attach volumes) enabled. 

aws ec2 create-volume –volume-type io2 –multi-attach-enabled –size 10 –iops 2000 –availability-zone ap-south-1a

OUTPUT: 

{ “AvailabilityZone”: “ap-south-1a”, “CreateTime”: “2021-05-15T18:35:02+00:00”, “Encrypted”: false, “Size”: 10, “SnapshotId”: “”, “State”: “creating”, “VolumeId”: “vol-00296ed56d790c9b0”, “Iops”: 2000, “Tags”: [], “VolumeType”: “io2”, “MultiAttachEnabled”: true }

Step 4: 

Enable Multi Attach (AWS/EBS-Operations-and-Advantages#multi-attach-volumes) to already provisioned io1 or io2 volumes. 

aws ec2 modify-volume –volume-id vol-089d1f89365557679 –multi-attach-enabled

OUTPUT: 

{ “VolumeModification”: { “VolumeId”: “vol-089d1f89365557679”, “ModificationState”: “modifying”, “TargetSize”: 8, “TargetIops”: 1000, “TargetVolumeType”: “io2”, “TargetMultiAttachEnabled”: true, “OriginalSize”: 8, “OriginalIops”: 1000, “OriginalVolumeType”: “io2”, “OriginalMultiAttachEnabled”: false, “Progress”: 0, “StartTime”: “2021-05-15T18:47:56+00:00” } }

Delete an Amazon EBS Volume 

Here’s the command to delete an Amazon EBS Volume: 

aws ec2 delete-volume –volume-id vol-03ab372122136d9cb

OUTPUT : 

NO OUTPUT

Advantages of Amazon EBS Volume

Listed below are some of the advantages of Amazon EBS Volume: 

  1. Highly Scalable. 
  2. Snapshots can be created and restored. 
  3. Maximum IOPS performance 
  4. Mountable on different instances. 
  5. Monitoring through Cloudwatch.

Wrapping Up

At SysAlly, we experiment with Cloud and the most useful information is passed on to the world as blogs. Signup for the updates.

Until later, here’s SysAlly signing off!

Get new insights right to your inbox

How can our experts help you?

Schedule your consultation

You may also like

  • By admin
  • in DevOps

DevOps as a Service: All You Should Know

  • Aug 9, 2022 .
  • 9 min min
Read More
  • By admin
  • in Containerization

Containerization VS Virtualization: Understanding the Differences

  • Aug 4, 2022 .
  • 8 min min
Read More
  • By admin
  • in DevOps

Best DevOps Tools You Must Try in 2022

  • Jul 26, 2022 .
  • 12 min min
Read More

Be in the know

Techno tips served hot! Subscribe now and stay atop.