DEV Community

Posted on • Updated on

Cost Optimization #1 : AWS EBS Volume type - IO1 or IO2?

Benjamin Franklin once said - "Beware of little expenses. A small leak will sink a great ship". Usually storage costs are not high as compared to running an instance on cloud but when you require higher IOPS and throughput, storage can definitely bump up your bill significantly. Until today, AWS EBS (Elastic Block Storage) had io1 volume type which delivers higher performance (IOPS and throughput) but it comes at a cost.

Problem Statement

Let me show you an example which compares the cost per month of 2 EBS volume types (GP2 and IO1) to explain the above statement. If you would like to know more about GP2 and IO1 volume types, you can refer to the EBS Volume Types:

Assumptions:

1. Region is N.Virginia (Price is dependent on regions)
2. The prices below are calculated for 1 month usage and is taken from AWS Calculator
3. Both IO1 and Gp2 volumes are taken as 100GB but an additional attribute added with IO1 is that we will provision 1000 IOPS as most people use IO1 to deliver higher IOPS with reduced size.
``````Cost for GP2:
==============
100 GB x 0.10 USD = 10.00 USD      (EBS Storage Cost)

Total cost (monthly): 10.00 USD

Cost for IO1:
==============
100 GB x 0.125 USD = 12.50 USD     (EBS Storage Cost)
1,000 iops x 0.065 USD = 65.00 USD (EBS IOPS Cost)
12.50 USD + 65.00 USD = 77.50 USD  (Total EBS storage cost)

Total cost (monthly): 77.50 USD
``````

You can see from the above comparison that there is a huge price difference between the 2 volumes and if you exponentially increase the number of IO1 volumes in your environment, it can increase the operating cost of your infrastructure significantly.

Solution

Recently AWS announced the launch of AWS EBS IO2 volumes and using IO2 volumes instead of IO1 volumes can result in optimizing your costs and benefiting from the improved performance and reliability at the same time. You can read more about it from Blog for IO2 volume type.

Now the question that comes to our minds is how does IO2 volume type translates to cost savings? I have explained it below:

1. Better performance with small volume size: The biggest benefit that can be realized from IO2 volumes is that of the performance even with a smaller volume size. Let me explain - IO2 volumes can deliver maximum of 500 IOPS per 1 GB where as IO1 volumes can deliver maximum of 50 IOPS per 1GB. Therefore, you can now create smaller volume sizes with higher IOPS and thereby reducing the cost of per GB-month of provisioned storage. For example, in the past to achieve 10,000 IOPS, you would be creating a 200 GB IO1 volume where your actual data size might be 75 GB only and you had to over-provision more than 100% just to meet the ratio of 50 IOPS/GB. But now, you can provision just 100 GB and still get the required 10,000 IOPS and thus reducing your cost component of storage by saving 100 GB.

2. Same Price for IO1 and IO2: Another factor that makes IO2 volumes attractive from cost perspective is that AWS has kept the pricing same for IO1 and IO2 volume types as can be seen in the EBS Pricing Page. Rather than asking the avid readers to go there, I will share the pricing for N. Virginia region below for the 2 volume types:

• Provisioned IOPS SSD (io2) Volumes \$0.125 per GB-month of provisioned storage AND \$0.065 per provisioned IOPS-month

• Provisioned IOPS SSD (io1) Volumes \$0.125 per GB-month of provisioned storage AND \$0.065 per provisioned IOPS-month

The above numbers show that the pricing makes IO2 definitely more lucrative than using IO1.

Migrate existing IO1 to IO2

For those who are interested in migrating existing EC2 instances from IO1 to IO2 volume types:

• If your intention is to reduce the volume size in the process, then unfortunately, AWS EBS does not allow decreasing the size upon modification. Therefore, the only way you can achieve this is to assign a new IO2 volume of the required size and then run rsync command to copy your data from current volume to the new volume. You can refer to some of the examples and commands given in this document to make use of rsync

• If you would like to just change the volume from IO1 to IO2 without reducing the volume size, or increase the volume size in the process, then you can follow the EBS Modification Documentation

Conclusion

Using IO2 volumes have certainly an advantage over the IO1 volumes considering the performance and durability benefits even though it means that you are not saving any cost between the 2 volumes. Next time when you are provisioning IO1 volumes, just think about the future, what if you need more performance than today in future, would you want to increase the size of volume to get the desired IOPS or will it be better to just increase the IOPS only without any change in the volume size?