An EBS pricing tutorial: How to calculate and predict EBS costs
Don’t wait until your Finance team complains about surging EBS bills. It’s time to find a more proactive approach to handling the dynamic realities of block storage–and the cost repercussions that come along with it.
If you are responsible for provisioning or managing a large number of Amazon Elastic Compute Cloud (EC2) instances, it’s important to understand the effect of EBS (Amazon Elastic Block Store) pricing on the overall cost.
EBS volumes are very easy to create and configure. However, its pricing can vary widely between different volume types, available features, and the amount of storage provisioned. This can seem hard to understand at times, and if you’re not careful, the costs can get quite high–especially if you have to account for unexpected changes as you grow.
In this article, we will talk about different EBS pricing categories and learn how to calculate and predict EBS costs upfront so you can budget accordingly.
EBS volume types
To understand EBS pricing, first, let’s understand the different types of volumes available
Standard magnetic volumes
The previous generation standard EBS volumes backed by magnetic hard drives are still used for some workloads today. These EBS volumes can have a maximum size of 1 TB and can offer up to 200 IOPS (Input/Output per Second).
HDD storage volumes
Currently (as of May 2021), there are two types of HDD storage volumes:
Cold HDD (sc1) volumes
sc1 type Cold HDDs are the lowest priced EBS volumes ($0.015/GB-month) and are suitable for storing infrequently accessed data like backups and archives. These volumes generally have higher capacity and performance than the standard magnetic volumes.
Throughput-optimized HDD (st1) volumes
Next up on the ladder is throughput-optimized st1 volumes. The significant difference between st1 and sc1 or standard magnetic volumes is that st1’s offer throughput optimization. In other words, when you provision an st1 EBS volume, you can specify its IO throughput. st1 volumes are better suited for high throughput workloads like log management, big data, data warehouses, ETL, or streaming applications.
Most write-intensive workloads are better served by SSD-backed EBS volumes. These volumes can quickly access data due to the non-rotational nature of the underlying solid-state devices (SSD). Currently (as of May 2021), there are five types of SSD-backed volumes.
gp2 general purpose SSD volumes
gp2 is the default SSD-backed EBS volume for EC2 instances. AWS recommends using this type of volume for smaller workloads like boot volumes, non-production environments, or small-scale applications.
gp3 general purpose SSD volumes
gp3 is the latest generation general-purpose SSD-backed EBS volume. It can be used for a wide variety of workloads that need low-latency performance such as single instance databases, VDIs, medium-scale data warehouses, and so on.
io1 provisioned IOPS SSD volumes
io1 provisioned IOPS SSD-backed EBS volumes offer higher IO performance, throughput, and lower latency than their general-purpose cousins. These volumes are best suited for IO and throughput-intensive workloads like MPP data warehouses, large OLTP databases, or NoSQL backends.
io2 provisioned IOPS SSD volumes
The io2 provisioned IOPS SSD EBS volumes are similar to io1 SSD volumes as they have the same maximum IOPS. However, they have a much higher durability and IOPS-to-storage ratio. AWS recommends using io2 SSD volumes for workloads like SAP Hana, IBM DB2, Oracle, etc.
io2 block express volumes
io2 Block Express is the latest generation io2 SSD-backed EBS volume. It’s IOPS and throughput can be four times that of io1 or io2.
EBS pricing factors
Now that you know about different types of EBS volumes, let’s see how they affect cost. EBS pricing depends on a few factors:
- Volume type and the storage size.
- Provisioned throughput.
- Provisioned IOPS.
- Total snapshot size.
- Fast Snapshot Restore (FSR).
- EBS direct APIs for snapshots.
Keep in mind that not all the costs apply to all volume types, and sometimes you won’t be using some of the features offered like FSR. Also, AWS offers free tiers for baseline performance and throughput.
EBS cost types
Generally, EBS costs can be split into three categories:
- Baseline costs
- High performance volumes costs
- Snapshot costs
EBS baseline costs
Typically, each EC2 instance will be provisioned with one or more EBS volumes for storing operational components like application binaries. These are typically small volumes that don’t require high performance or provisioned IOPS. These volumes don’t need backups and will be detached (and perhaps deleted) when the EC2 instance is terminated.
The cost of these types of volumes depends on the volume type and size only, and are charged as GB-month. That’s the total size of the volume in GB over a total month calculated as per second increments with a 60-second minimum.
So, let’s say you provisioned a 500 GB gp2 General Purpose SSD volume for your EC2 instance running in Mumbai, India. The storage cost in that region at the time of writing is $0.114 per GB-month of provisioned storage. Let’s also say, you deployed the volume on the 14th of September at 2:00 PM.
With 30 days in September, it would be 15 days and 10 hours (2 PM to 12:00 AM on 14 September) before the current calendar month’s billing period ends for that EBS volume.
In other words, the EBS volumes will be up for:
(10 x 3,600) seconds + (15 x 24 x 3,600) seconds = 1,332,000 seconds.
In September we have (30 x 24 x 3600) = 2,592,000 seconds.
So, the storage charge will be 500 GB x $0.114/GB-month x (1,332,000 seconds / 2,592,000 seconds) = $29.29.
If you have provisioned multiple EC2 instances each with this volume configuration on the same date, you can simply multiply the figure with the number of instances.
High Performance EBS Volume Costs
Not all EBS volumes are the same. Some specific EBS volumes are provisioned with extra throughput and/or IOPS, and there’s a cost associated with premium performance.
The calculation for provisioned throughput (MB/s) and provisioned IOPS work the same way as GB-month. Provisioned throughput charge is calculated as MB/second-month and provisioned IOPS is charged at IOPS-month.
If you decided to deploy an EBS volume as gp3 General Purpose SSD, you could provision both its throughput and IOPS. These charges are not applicable to the SSD gp2 volume you provisioned.
So let’s say, instead of gp2, you decided to provision the EBS volume as a gp3 General Purpose SSD, 500 GB size with a provisioned IOPS of 15,000, and a disk throughput of 500 MB/second in the Mumbai region (India).
Currently , Amazon doesn’t charge anything for up to 3,000 IOPS and 12 MB/second. So your AWS account will only be charged for 15,000 – 3,000 = 12,000 IOPS, and 500 MB/s – 125 MB/s = 375 MB/s for the volume.
Also, currently (May 2021) in the AWS Mumbai region, gp3 volumes cost:
- $0.0912/GB-month for storage.
- $0.0057/provisioned IOPS-month above 3,000 IOPS.
- $0.0456/provisioned MB/s-month over 125 MB/second provisioned.
Remember that we have (30 x 24 x 3600) = 2,592,000 seconds in September, and we are using 1,332,000 seconds in that month.
Using all this information, let’s calculate the total charge for the gp3 volume.
- The storage cost will be 500 GB x $0.0912/GB-month x (1,332,000 seconds / 2,592,000 seconds) = $23.43.
- The provisioned IOPS charge will be 12,000 IOPS x $0.0057/provisioned IOPS-month x (1,332,000 seconds / 2,592,000 seconds) = $35.15
- The provisioned throughput charge will be 375 MB/second x $0.0456/provisioned MB/s-month x (1,332,000 seconds / 2,592,000 seconds) = $8.79
The total charge for that volume in September would be: $23.43 + $35.15 + $8.79 = $67.37.
This is significantly higher than the previous figure of storage-only charge ($29.29). It shows how costs associated with high performance EBS volumes can add up quickly, and become a very relevant part of your AWS bill.
EBS Snapshot costs
For most production data volumes, you will want to create backups. In EBS, that’s done with snapshots. EBS snapshots are saved in S3 in a compressed format. The first snapshot contains all the contents of the volume, and subsequent snapshots only contain contents of the changed block. This also means your AWS account will be charged only for the changed blocks after the first snapshot.
Regular snapshot costs
At the time of writing, EBS snapshots are charged $0.05 per GB-month of data stored. Other factors that affect snapshot cost include:
- Snapshot frequency.
- The compression ratio of the data.
- Data transfer costs for cross-region snapshots.
EBS snapshots costs are particularly hard to predict as they are based on the amount of space your data consumes (empty disk blocks aren’t counted). Snapshots are incremental by nature, and costs will be related to the amount of data that changed between snapshots.
Let’s say your EBS volume is consistently using 10 GBs of space, and every day there’s 1GB of data changed from the previous day. You have daily backups of the volume happening and the backups are kept for a month.
- The initial snapshot cost will be $0.05 x 10(GBs) = $0.50.
- The rest of the snapshot will cost $0.05 x 1 GB x 29 (snapshots) = $1.45.
Fast snapshot restore (FSR) costs
Amazon Fast Snapshot Restore (FSR) allows restoring an EBS snapshot without the initialization overhead at volume creation time. This eliminates the usual I/O latency when a block in the restored volume is accessed for the first time. With FSR, a restored EBS volume immediately starts operating with its provisioned performance.
FSRs are charged in Data Services Unit-Hours (DSUs) for each snapshot and each Availability Zone (AZ) where it’s enabled. DSUs are charged per minute with a minimum of 1 hour. You can enable FSR when you create a snapshot. AWS will keep charging the FSR-enabled snapshot until you disable it.
FSR costs $0.75 per DSU hour in each Availability Zone where it’s enabled.
EBS direct APIs for snapshots costs
Amazon Direct APIs for snapshots allow applications to directly read data from snapshots and find differences between two snapshots. This feature is mainly meant for backup applications, in order that users can find the changes between snapshots and reduce the backup time.
At the time of writing, Amazon lists three API pricing:
- ListChangedBlocks and ListSnapshotBlocks API calls are charged $0.0006 / 1,000 requests.
- GetSnapshotBlock API call is charged $0.003 / 1,000 SnapshotAPIUnits.
- PutSnapshotBlock API call is charged $0.006 / 1,000 SnapshotAPIUnits.
Predicting EBS costs
AWS prices change all the time and EBS volume types also undergo changes, so it’s best you refer to the EBS pricing page for the latest price. As a general rule though, you can refer to the following table for applicable charges across different volume types:
You can also refer to the previous generation EBS pricing page for magnetic volume pricing. Magnetic volumes are priced by:
- Provisioned storage per GB-month.
- Per 1-million I/O requests.
The easiest way to predict EBS costs is to access the AWS pricing calculator. In the image below, we are using the same figures for the 500 GB gp3 volume in the us-east-1 region and calculating the costs for a full month (730 hours) and two daily snapshots. The snapshots will have 200 MB of data changes per snapshot:
Analyzing EBS costs
After running EBS volumes for a few months, you should also be able to check the trends in the AWS Cost Explorer.
You can select EBS groups in the “Usage Type Group” dropdown list, and then analyze EBS costs by region, AWS account, or usage type.
As with most resources in AWS, using meaningful and consistent tagging of EBS volumes and snapshots will allow you to further drill down and apportion the costs.
Predicting and understanding EBS costs is initially quite daunting. But most costs are either related to provisioned storage, provisioned high performance, or snapshots. If you are using high performance disks, make sure you pay attention to the prices as costs can add up quite fast.
In addition, it’s also smart to make sure you are not overpaying for storage by allocating significantly more disk space than your application needs. While you may be tempted to do so in order to compensate for future spikes in demand, another solution is to explore automation that enables your EBS volumes to respond dynamically to changing application demands as soon as they occur.