- Pricing & Cost Optimization
Amazon EBS Volumes: gp2 vs gp3 Analysis
If you’ve worked with Amazon Elastic Compute Cloud (Amazon EC2) before, then you’ve likely heard of Amazon Elastic Block Store (Amazon EBS) as well. Amazon EBS is one of three main storage services in Amazon Web Services (AWS), along with Amazon Simple Storage Service (Amazon S3) and Amazon Elastic File System (Amazon EFS).
Amazon EBS provides additional block-level storage to your Amazon EC2 instances. Each storage device is called an EBS volume and can be attached to any EC2 instance.
There are many advantages to using an EBS volume over the regular instance store, which is temporary block-level storage that comes with your EC2 instance. For example, if you terminate your instance, any data that was present in the instance store is now lost since it was directly attached to your instance. However, data stored in an EBS volume attached to your instance is preserved. In fact, you can even reattach your EBS volume to another EC2 instance.
EBS volumes come in many flavors. However, there are two main types of General Purpose solid-state drive (SSD) volumes that AWS provides today:
gp3. As you might expect,
gp3 volumes, which were launched in December of 2020, are considered the latest generation of SSD volumes. However, should you always choose
gp2? In this article, you’ll compare the differences in performance and cost between
gp2 volumes. In addition, you’ll learn how to easily migrate your existing
gp2 volumes to
gp3 if you choose to make this upgrade.
What Are EBS Volumes
Before learning more about the specifics of
gp3 volumes, following are a few reasons why you might want to use EBS in the first place.
Persistent, Flexible Data Storage
As previously stated, EBS volumes exist independently of EC2 instances. This means that any data you store in an EBS volume is retained even if your instance is stopped, restarted, or terminated. Therefore, you must use EBS volumes for data that you intend to preserve for longer than the lifetime of your instance.
You can also reattach your volumes to different EC2 instances. This gives your data more flexibility when stored in an EBS volume as opposed to the instance store volume.
High Data Availability
Any EBS volume that you create is automatically replicated within the Availability Zone (AZ) that it’s in. This would prevent the loss of data if one of those replicas were to become corrupted. You can also create snapshots of your EBS volumes, which are point-in-time backups of your data that you can copy to S3. This is helpful in case an entire AZ fails since you can simply recreate your EBS volume from a previous snapshot.
Security and Encryption
If you’re dealing with sensitive data, it may be legally required for you to ensure that the data is fully encrypted and secure. All EBS volume types support fully managed encryption, both for data at rest and data in transit from the EC2 instance to the EBS volume. The data is encrypted using the AES-256 algorithm along with the AWS Key Management Service (AWS KMS).
Good for Rapidly Changing Data
gp3 volume types are SSD-backed volumes. Compared to hard disk drive (HDD)–backed volumes, SSDs are optimized for workloads involving frequent read and write operations. This makes them perfect for storing data that might be rapidly changing and require high input/output operations per second (IOPS).
The AWS Ecosystem
EBS is part of the AWS ecosystem, which means it’s naturally integrated with many other services. In the previous subsections, you’ve already seen how EBS works with other AWS services, such as EC2, S3, and KMS. EBS also has great technical support and extensive documentation about all their volume types.
gp2 vs gp3
Now that you know more about how EBS volumes can be used, it’s time to talk specifically about the
gp3 volume types that AWS offers. Current generation EBS volumes come in two main categories: SSD and HDD. Among SSD volumes, there are two further subcategories, as outlined in the AWS documentation:
- General Purpose SSD volumes provide a balance of price and performance. Most of the time, these will suffice.
- Provisioned IOPS SSD volumes are designed for high-throughput workloads that consistently require more than 16,000 IOPS, and it comes at a higher cost.
gp3 volume types fall under General Purpose SSDs (the gp stands for “general purpose”). The rest of this article will focus on only comparing these two volume types.
gp2 volumes already provide users with highly available, cost-effective, and scalable storage. So why is there a need to create
gp3 volumes, and how does this address the limitations of
Before anything else, it’s important to understand how
gp2 volumes perform and how they scale. The AWS documentation lists the following specs for
- Max IOPS per volume: 16,000
- Max throughput per volume: 250 MiB/s
These are great numbers that perfectly handle most applications. However, note that these are just maximum figures, and the actual IOPS you get is directly proportional to the size of the volume. Specifically, your EBS volume performance scales linearly at 3 IOPS per GiB of volume size. This means that to achieve an IOPS of 16,000, you’d need a
gp2 volume size of at least 5.33 TiB. In addition, to get the maximum throughput of 250 MiB/s consistently, you need a volume larger than or equal to 334 GiB.
In some cases, this is neither practical nor cost-efficient. Many applications, such as Cassandra and Hadoop clusters, demand high performance but don’t necessarily require high storage capacity. In other words, many customers are forced to provision larger
gp2 volumes for the performance, even if they don’t need the extra space.
gp3 volumes solve this issue by providing a baseline level of performance as well as a way for you to provision additional IOPS and throughput for an additional cost. Following are the specs for
- Baseline IOPS per volume: 3,000
- Baseline throughput per volume: 125 MiB/s
- Max IOPS per volume: 16,000
- Max throughput per volume: 1,000 MiB/s
The main difference here is that the linear relationship requirement between volume size and performance in
gp2 is largely eliminated with
gp3 volumes, you can provision up to a maximum of 500 IOPS per GiB of volume size. This means that you only need a
gp3 volume size of at least 32 GiB in order to hit the maximum 16,000 IOPS performance.
In addition, while
gp2 volumes were capped at a maximum of 250 MiB/s throughput, you can get up to 1,000 MiB/s with
gp3. The requirement here is that you can only provision 0.25 MiB/s per provisioned IOPS. This means that you can attain the maximum 1,000 MiB/s throughput if you have 4,000 provisioned IOPS, which requires at least a volume size of 8 GiB.
Here’s a summary:
- You can achieve maximum performance (16,000 IOPS) with a volume size of at least 32 GiB with
gp3. To achieve the same maximum performance with
gp2, you’d need a volume size of at least 5.33 TiB.
- You can achieve maximum throughput (1,000 MiB/s) with a volume size of at least 8 GiB with
gp3. To achieve the maximum throughput with
gp2(250 MiB/s), you’d need a volume size of at least 334 GiB.
gp3allows you to achieve and maintain high performance without having to provision larger volumes.
Of course, the other major factor here is cost. In addition to higher performance,
gp3 also comes with lower costs:
gp2volumes: $0.10 USD per GB-month
gp3volumes: $0.08 USD per GB-month
gp3IOPS: 3,000 IOPS free (baseline) and $0.005 USD per provisioned IOPS-month over 3,000
gp3throughput: 125 MiB/s free and $0.04 USD per provisioned MiB/s-month over 125
From this, you can see that for the same amount of storage space,
gp3 is 20 percent more cost-effective than
gp2 volumes. It’s also interesting to consider what a maximum performance and maximum throughput volume would cost for both
gp2, you need a 5,333 GiB volume to attain the maximum 16,000 IOPS and 250 MiB/s. For one month, this would cost around 5,333 ✕ 0.10 = $533.33 USD.
gp3, to achieve this same performance, you need just 32 GiB of storage to get 16,000 IOPS. However, you’d also need to pay for 13,000 additional IOPS and 125 additional MiB/s (for 250 MiB/s total). For one month, this would cost around (32 ✕ 0.08) + (13,000 ✕ 0.005) + (125 ✕ 0.04) = $72.56 USD.
- To achieve max
gp3performance, you need to pay for an additional 750 MiB/s. This would bring your cost to 72.56 + (750 ✕ 0.04) = $102.56 USD.
Based on this cost analysis, you’ll almost always want to choose
Migrating from gp2 to gp3
You can easily migrate your existing
gp2 volumes to
gp3 via the EC2 console or the AWS CLI.
From the EC2 Console
To migrate a
gp2 volume to
gp3 via the EC2 console, follow these steps:
- Choose Volumes on the left pane of the EC2 console, under Elastic Block Store.
- Choose the volume ID that you want to migrate.
- Select Modify.
- Choose General Purpose SSD (gp3) for Volume type on the Modify volume interface. Choosing General Purpose SSD (gp3) will allow you to make additional configuration changes for size, IOPS, and throughput if you want to.
- Select Modify once you’re done changing the volume settings. On the confirmation pop-up, again, select Modify.
From the AWS CLI
To migrate a
gp2 volume to
gp3 via the AWS CLI, use the
For example, if your volume ID is
vol-:1234567890123456, you can run the following command:
aws ec2 modify-volume --volume-type gp3 --volume-id vol-1234567890123456
In this article, you learned about EBS volumes and why you might want to use them in your cloud application. In particular, you took a deep dive into the
gp3 EBS volume types, which are General Purpose SSDs that fit a wide variety of applications and use cases.
After a thorough analysis of the performance and pricing differences for these two volumes, you should strongly consider migrating your
gp2 volumes to
gp3 if you haven’t already. It’s very easy to do so from the EC2 console or the AWS CLI.
If you want to take Cost Optimization one step further, you should check out CloudForecast, with its ZeroWaste feature. CloudForecast is designed to detect automatically available EBS optimizations (like unused EBS snapshots and unattached EBS volumes), and it helps you with other services, like EC2, Amazon Relational Database Service (Amazon RDS), and S3.
Alexander Yu is a technical writer at AWS by day and a freelance writer by night. After completing his BS in electrical engineering and computer science from UC Berkeley, he became a software developer at AWS for almost three years before transitioning into technical writing. He lives in Seattle with his dog Yuna.
Manage, track, and report your AWS spending in seconds — not hours
CloudForecast’s focused daily AWS cost monitoring reports help busy engineering teams understand their AWS costs, rapidly respond to any overspends, and promote opportunities to save costs.
Subscribe To Our Newsletter
Subscribe to get our latest news, features, and any updates.
AWS Cost Management Is Made Easy With CloudForecast
We would love to learn more about the problems you are facing around AWS cost. Connect with us directly and we’ll schedule a time to chat!