DEV Community

Ivy Jeptoo
Ivy Jeptoo

Posted on

Elastic Block Store(EBS)

We previously learnt how to create an EC2 instance and connect to it. you can recap here.

While still on this there are two types of storage in EC2:

i) In Memory(instance store) - which provides temporary block-level storage that is directly attached to the EC2 instance. It is ideal for temporary data, cache, or scratch space that doesn't need to persist beyond the lifespan of the instance.

ii) EBS( elastic block store) - provides persistent block-level storage volumes that can be attached to EC2 instances. It offers durable and reliable storage that persists independently of the instance's lifespan.

Let us dive more into EBS.

  • Amazon Elastic Block Store (EBS) provides storage volumes for use with EC2 instances. These volumes act like raw, unformatted block devices that can be mounted on your instances. They persist independently from the life of the instance. You can create a file system or use them like a hard drive. EBS volumes offer fast access to data and long-term persistence, making them great for file systems, databases, and applications that need frequent updates and direct access to block-level storage. They work well for both random reads and writes and continuous read and write operations.

Features of EBS

a). EBS provides General Purpose SSD, Provisioned IOPS SSD, Throughput Optimized HDD, and Cold HDD as volume types.

  • General Purpose SSD volumes (gp2 and gp3):

    • Ideal for transactional workloads.
    • Balance price and performance.
    • Suitable for boot volumes, medium-size single instance databases, and development/test environments.
  • Provisioned IOPS SSD volumes (io1 and io2):

    • Designed for I/O-intensive workloads.
    • Offer consistent and predictable IOPS rate.
    • Scale to tens of thousands of IOPS per instance.
    • io2 volumes provide highest volume durability.
  • Throughput Optimized HDD volumes (st1):

    • Low-cost magnetic storage.
    • Performance measured in terms of throughput.
    • Suitable for large, sequential workloads like Amazon EMR, ETL, data warehouses, and log processing.
  • Cold HDD volumes (sc1):

    • Low-cost magnetic storage.
    • Performance measured in terms of throughput.
    • Ideal for large, sequential, infrequently accessed data.
    • Cost-effective solution for storing cold data.

b). EBS Volume Encryption - This allows one to encrypt their EBS volumes to meet data-at-rest encryption requirements for regulated or audited data. It also ensures that the stored data in the volume. disk I/O and snapshot is encrypted.

  • Encryption happens on the servers hosting EC2 instance which secures data both at rest and during transit.

c). EBS Snapshots allows you to create point-in-time copies of your EBS volumes which are stored in S3. The snapshot provide long-term durability and serve as a starting point for new EBS volumes.

  • The same snapshot can be used to create multiple volumes as needed and the snapshots can be copied across different AWS Regions.

d). Performance Metrics such as bandwidth, latency, and average queue length are provided by Amazon Cloudwatch and it allows you to monitor the performance of your EBS volume.

  • Monitoring helps ensure that you are allocating sufficient performance resources for your applications without paying for unnecessary resources.

e). When you create an EBS volume, it is linked to a specific Availability Zone (AZ). This means that the volume is located in a particular data center within a specific geographic region. However, if you want to use the volume in a different AZ within the same AWS Region, you can create a snapshot.

  • A snapshot is a copy of your EBS volume's data and settings. It captures all the information stored on the volume at a specific point in time. By creating a snapshot, you essentially create a backup of your volume.

  • Once you have a snapshot, you can use it to restore the volume to a new EBS volume in any AZ within the same AWS Region. This means you can move your volume's data from one AZ to another without losing any information. The restored volume will have the same data and settings as the original volume at the time the snapshot was taken.

Creating EBS Volume

AWS allows us to create a volume from either of the following three methods:

i) Create and attach EBS volumes while creating an EC2 instance using the Launch Instance wizard.
ii) Create an empty EBS volume, and later you can attach it to a running instance.
iii) Create an EBS volume from a previously created snapshot, and later you can attach it to a running instance.

We are going to use option 2 to create EBS

STEPS

  • On the EC2 Dashboard select the Elastic Block Store → Volumes service on the left navigation pane.
  • Select the Create Volume button as on the screenshot below:

dashboard

  • Specify the volume details on the set-up wizard page.
  • You will have to specify the following details:

i)Volume type - AWS offers various types of volumes, as described in the table below.
ii)Size (GB) - Mention the size with-in limits of the type you have chosen above.
iii) Availability Zone - It has a default value, or you can choose your preferred AZ.
iv)Snapshot ID - Specify the ID of the snapshot if you wish to create a volume from an existing snapshot. Remember, a snapshot is the saved state of another volume at a particular moment.
v) Tag - Specify the key-value pair, such as {Name: U-test}

details

  • Click on the Create Volume and your EBS will be created.

EBS Dashboard

  • On the EC2 Dashboard select the Elastic Block Store → Volumes service in the left navigation pane.

ebsdashboard

List of all Volumes

  • On the image above it is labeled as 1, here you can view all the volumes available under your account in a specific region.

There is ID, size, type, I/O per second, snapshot ID of that volume, date of creation, availability zone, current status, whether the volume is encrypted and the EC2 instance to which it is attached.

  • You can do several operations after creating a volume which includes:
    • Attach a volume to one or more EC2 instance(s)
    • Detach a volume from an instance
    • Replace a volume
    • View the volume details, and monitor the current status
    • Delete a volume

Details of Selected Volume

This is the second part of the EBS Dashboard, Select the checkbox against the name of any volume.

  • Details - you can view the specific information, such as volume ID, snapshot ID, size, date of creation, instance to which it is attached, type of volume, and much more.

  • Status Check - Here you can view the health status of the selected volume. There are four possible status: Okay, Warning, Impairedor insufficient-data. See more details about the status here. You can view IO status, pre-defined IO performance, dates, and further textual description (selective).

status

  • Monitoring - Here you can view the I/O performance metrics for the selected volume, such as:
    • read/write bandwidth (kB/sec),
    • read/write throughput (Operations/sec),
    • average queue (Operations)
    • Idle time (%)
    • avg read/write size (kB/Operation)
    • avg read/write latency (msec/Operation)

monitoring

  • Tags - Here, you can have a look at the associated tag. In the snapshot above, it shows the Name tag with U-test value.

tags

Conclusion

  • Amazon Elastic Block Store (EBS) provides versatile storage for Amazon EC2 instances. With features like volume encryption, snapshots, and performance monitoring, EBS offers secure data-at-rest, reliable backups, and efficient resource allocation. It allows flexibility by associating volumes with Availability Zones (AZs) and restoring snapshots to different AZs within the same AWS Region for workload distribution, migration, and disaster recovery. EBS is essential for scalable and reliable architectures on AWS.
  • You can read more on EBS here

Top comments (0)