Amazon Elastic Block Store storage

Amazon Elastic Block Store (EBS) is a block-level storage that many EC2 instances use as storage (as the only option). Therefore if you plan to use EC2 instances, you should learn more about EBS or you'll find out the hard (pricey) way that you can still get charged even with a stopped instance.

EBS volumes are independent and not associated with any particular instance. Therefore, they continue to persist even when an EC2 instance has been stopped and can continue to incur charges. They are conceptually similar to Storage Area Network and can be mounted to different instances as a volume. However, note that the volume must have a file system and the file system must be compatible with the operating system of the instance.

There are different Amazon EBS volume types and for EC2 instances, the General Purpose SSD volumes are generally suitable for instances; for more information refer to this overview.

It is possible to attach multiple EBS volumes to a single instance but the volume and instance must be in the same Availability Zone.

EBS are optimised for use with EC2 instances by default, which means that:

When attached to an EBS–optimized instance, General Purpose SSD (gp2 and gp3) volumes are designed to deliver at least 90% of their provisioned IOPS (I/O operations per second) performance 99% of the time in a given year,

EBS's can be backed up by using snapshots, which are a copy of the EBS volume at a given time. The snapshot is stored using S3 in the same region as the EBS and is internally controlled. After the first snapshot, subsequent snapshots store only modified bits, typical of backup systems. A snapshot can be used to re-create an EBS volume.

Snapshots are slightly cheaper to store than EBS but note that you can still be charged even if snapshots are deleted. EBS storage costs USD 0.12 per GB-month of provisioned EBS storage in the Asia Pacific (Tokyo) Region. Depending on the type of EBS, I/O requests are charged. For the EBS General Purpose SSD (gp2) volume, I/O is included in the price of the volumes, so you only pay for the GB storage provisioned (how much space was requested). Note that even if you do not use the storage, you will be charged for it, so make sure you only ask for (provision) what you need.

As an example, let's say that you provision a 2,000 GB volume for 12 hours (43,200 seconds) in a 30-day month. In a region that charges $0.10 per GB-month, you would be charged: ($0.10 per GB-month 2,000 GB 43,200 seconds / (86,400 seconds/day * 30 day-month)) = Total: $3.33 per 30-day month.

Here's the calculation in R:

cost <- function(rate, hrs, gbs, days = 30){
  sec_per_day <- 60 * 60 * 24
  elapsed_sec <- hrs * 60 * 60

  round(rate * gbs * elapsed_sec / sec_per_day / days, digits = 2)
}

cost(0.1, 12, 2000)
# [1] 3.33

If I wanted to keep a 20G EBS volume (gp2) around (without generating any snapshots), I would have to pay USD 2.4 a month.

cost(0.12, 24*30, 20)
# [1] 2.4

Check out the EBS volumes user guide to find out more.

Print Friendly, PDF & Email



Creative Commons License
This work is licensed under a Creative Commons
Attribution 4.0 International License
.

Leave a Reply

Your email address will not be published. Required fields are marked *

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