Kloudle
academy

Create, attach, and detach EBS volumes

Riyaz Walikar
#aws#cloudsecurity#ebs
Feature image

Introduction

In our academy article - AWS EBS vs S3 vs EFS, we introduced the three storage services provided by AWS. After covering S3 in our last article, let’s deep dive into AWS EBS volumes in this one!

EBS (Amazon Elastic Block Store) is a type of storage from AWS which provides block level storage volumes. It is primarily used with EC2 instances in AWS and provides persistent data storage. The volumes can be scaled dynamically. We can also modify the IOPS capacity and change the volume type as well.

This article provides a walkthrough of how EBS volumes can be created, attached to and detached from an EC2 instance through the AWS console.

Creating an EBS Volume

  1. Log in to your AWS account via console (https://aws.amazon.com/console/)

  2. Once you have logged in, search for EC2 in the Search bar

  3. Once the EC2 console opens select Volumes on the left side navigation pane under the Elastic Block Store section

  4. Click on Create Volume option

    EBS create volume

  5. In the Volume Settings, provide the **Volume Type.**For more details about volume type refer to this AWS documentation ( https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html )

    EBS volume type

  6. Select the size of the volume as per the requirement.

    There are certain constraints on sizing of EBS volumes. For details refer the following documentation ( https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/volume_constraints.html )

    EBS volume size

  7. Select the IOPS for your EBS volume. IOPS is the number of I/O operations per second that the volume can support

    EBS volume IOPS

  8. Throughput is the amount of data transferred from or to a volume. For EBS it is measured in MiB/s.

    EBS volume Throughput

  9. A volume can be attached to an EC2 Instance which is in the same AZ (Availability zone). So select the AZ in which your EC2 Instance is present and to which you want to attach the volume

    Select Availability zone

  10. In Snapshot ID select the option Don’t create volume from a snapshot since in this walkthrough we want to create a fresh volume.

    You can select the snapshot ID in case you want to create the volume from an existing snapshot.

    snapshot ID

  11. Encryption helps secure your data on EBS volumes. It uses the AWS KMS key to encrypt the data.

    Encryption EBS volume

  12. Create tags which will help to categorise your volumes, the team, or user it belongs etc.

    EBS volume Tags

  13. Select Create volumeand your volume will be successfully created.

    Create EBS volume

Attaching an EBS Volume to an EC2 instance

  1. Once the EBS volume is created select the EBS volume you want to attach to the EC2 Instance. The EBS volume should be in Available state.

    Select EBS volume

  2. Click on the dropdown of Actions and select the option Attach Volume

    Attach EBS volume

  3. Once the Attach Volume window opens select the EC2 instance you want to attach the volume

    Attach Volume to EC2

  4. Select the Device Name which is the same device name used by the EC2 Instance selected in step 3 above

    EC2 device name

  5. Select the Attach Volume option and the volume will be successfully attached. Once the volume is attached to an EC2 instance, the Volume Instance will be In-use.

    EBS Attach Volume

Detach an EBS Volume

  1. In the Amazon EC2 console, choose Volumes in the navigation pane on the right side

    select EBS volume

  2. Once the Volumes page opens, select the volume you want to detach. An attached volume shows in-use state

    EBS Volume to detach

  3. Click on the Actions drop-down and select the Detach volume option.

    select detach EBS volume

  4. A pop-up will appear for confirmation, select the Detach button to detach the volume from the EC2 instance.

    detach EBS volume

  5. Once you have successfully detached the volume you can again see that the volume is in Available state.

Conclusion

EBS volumes provide persistent storage and can be used just like physical hard drives for storing data. This article provides a step-by-step walkthrough of how you can create EBS volumes. It also covers how you can attach and detach volumes to your EC2 instances.

Follow along this article if you are looking to start out with EBS volumes and stay tuned for our next academy article where we will be covering a walkthrough for AWS EFS service.

← Back to Academy