DEV Community

Cover image for Reduce AWS costs: How I've saved $18,890 monthly on EBS drives?
Pawel Zubkiewicz for AWS Community Builders

Posted on • Updated on

Reduce AWS costs: How I've saved $18,890 monthly on EBS drives?

This is a case study of a real project, where one simple change in configuration resulted in almost a quarter of a million dollars savings per year.

There was a single AWS account which had around 17,000 EBS volumes, which totaled to 944,875 GB (almost 1000 TB). That's a serious amount of disk space for which you pay serious money.

CloudPouch Cost Insights

A CloudPouch tool identified possible savings on that account (screenshot above) regarding EBS Volumes. That was a starting point, which started the whole endeavor.

Before optimization, EBS:VolumeUsage.gp2 cost was around $100,000 monthly. That's just disk drive space, nothing else! All of those drives were of type GP2, which stands for General Purpose 2.

According to the CloudPouch tool, conversion to newer drive type GP3 would save 20%, which was $18,890 monthly in this case.

EBS GP3

AWS introduced new GP3 drives in December 2020. They provide up to 20% lower price-point per GB than existing GP2 volumes, and their performance is no longer coupled with their size! Which means you don't need to over-provision size to get expected performance.

If you're interested in detailed comparison this AWS blog post is the best place to start. The below table summarizes most important differences pretty well; it was copied from the over-mentioned blog post.

EBS GP3 vs GP2 comparison

Migration from GP2 to GP3

After learning more about GP3, migration sounded like a no-brainer. πŸ˜ƒ

The newer drive type should result in immediate decrease in costs by 20% without any performance impact on our drives, which were between 50 to 250GB each.

From a technical perspective, migration seemed pretty easy to conduct. AWS states:

Customers can easily migrate gp2 volumes to gp3 volumes using Elastic Volumes, which is an existing feature of Amazon EBS. Elastic Volumes allow customers to modify the volume type, IOPS, or throughput of their existing EBS volumes without interrupting their Amazon EC2 instances.

After confirming with AWS representative, that conversion from GP2 to GP3 does not impact running EC2 instance at all, I was ready to start.

The change can be applied manually in the web console, as showed in the image below. All you need to do is to select new type:

Web console screenshot

Of course, when you have 17,000 drives, you want to automate that!

Fortunately, you can do that using AWS SDK. It's surprisingly simple, given how much money you can save πŸ˜€

You need to get the list of all your EBS volumes using EC2.describeVolumes() method, and then modify those having VolumeType === 'gp2' to gp3 using another SDK method EC2.modifyVolume(). It really doesn't get any simpler than that. πŸ˜€

The EC2.modifyVolume() request asynchronously starts the migration, so the whole script runs pretty fast. Based on my research and discussions with AWS representatives, the whole operation can take up to 6 hours per drive, depending on size and other factors.

What's really important and amazing at the same time is that migration takes place in the background without interrupting EC2 instances. Also, we pay only for GP3 drive since the very start of the migration.

Results

Well, you already know the results but lets show them in the form of a chart.

EBS Volumes cost chart

The EBS:VolumeUsage.gp2 UsageType costs (yellow) were replaced with EBS:VolumeUsage.gp3 (red).

As expected, EBS Volumes costs dropped by 20%. In the case of this particular account, I was able to save $18,890 monthly - almost a quarter of a million dollars per year!

The migration took place at the end of 2021 year, we haven't had even a single problem with any EBS or EC2 instance using them.

Ongoing migrations

In the environment, where you can't control newly deployed EC2 instances and their EBS drives, you can deploy a Lambda Function, that would regularly migrate newly created drives to GP3 version. It's really easy to write and can save a lot of money.

Disclaimer

In most of the cases migration from GP2 to GP3 can be safely executed. However, preliminary analysis is recommended, especially to check if your existing drives have any special settings, like provisioned IOPS. Don't do this without thorough preparation.

CloudPouch

Everything described in this article can be done without CloudPouch.

However, if you want to examine all your AWS accounts and have immediate response about potential savings, CloudPouch is the tool to use!

  • Start in the Current month and scroll down to the AWS Services table.

Step 1

  • Select the EC2 - Other row, it will expend showing UsageType cost chart.

  • Next, click on Check Cost Insights πŸ” button. Now CloudPouch is connecting to your AWS account to get information about deployed resources.

Step 2

  • After a moment, a summary is displayed. Cost Insights summary

The Cost Insights summary includes not only GP2 to GP3 migration check, but also recommendations about:

  • "orphaned" drives - unattached EBS Volumes that are not used by any EC2 instance,
  • Elastic IPs - reserved but not used,
  • and needless NAT Gateways - sometimes people forget to remove them from VPCs that are no longer used.

All those resources can be considered waste - you don't use them, but you pay for them.

The summary also gives you an amount of potential savings, so you can make a data-driven decision whether it's worth optimizing.

Top comments (0)