Your EBS Perfect Volume
The Amazon EBS (Amazon Elastic Block Store) is a scalable, easy-to-use block storage service.
Paired with EC2, it is designed for high-performance and transaction-intensive workloads.
It achieves this by providing volumes that are mounted as disks on EC2 instances for onward usage with frequently changing data.
These volumes are flexible helping you keep your data available, encrypted, and stored for backups.
To meet the different needs of its users, AWS makes available two major categories of EBS Volume for EC2 instances: SSD-based and HDD-based volumes. You can have a look at the major differences between the different types of volumes here and here.
Today, we will be examining two main SSD volumes:
- io2 Block Express, the new, performance-optimized EBS volume perfect for high-efficiency transactional applications like the SAP HANA, Microsoft SQL Server, and SAS Analytics.
- gp3, the general purpose, cost-optimized EBS volume perfect for transactional applications such as virtual desktops and test environments.
The io2 Block Express EBS Volume
Amazon announced the general availability of the io2 Block Express EBS Volume for EC2 instances, the io2 Block Express volume allows users to get the best-performing block storage when deploying applications and databases that require the most intense I/O performance. Previously, this was not straightforward as developers had to attach multiple EBS volumes to a single instance to meet the desired throughput, IOPS, and capacity level.
Compared to the traditional io2 volumes that offer up to 64K IOPS capability, 1GB/s throughput, and single-digit millisecond latency, the io2 Block Express volume quadruples the capacity by providing up to 256,000 IOPS, 4 GB/s, and sub-millisecond latency.
The gp3 EBS Volume
The new gp3 general SSD EBS Volume for EC2 instances is an upgrade to the widely used gp2 volume. It allows users to provision storage capacity for the same workloads at a lower cost.
Like the gp2 EBS volume, gp3 has the same volume size, max throughput/instance, and max IOPS/Volume and Instance.
However, the gp3 has 4x the max throughput per volume (1 GB/s) than that of gp2 ( 250 MB/s).
With the previous gp2 volume, users had to configure a bigger storage volume if they needed a higher IOPS and throughput.
This is not the case with the pay-as-you-go format of the gp3, users don’t need to provide more capacity to increase performance and pay for only additional resources used.
With the gp3 EBS volume, users can run medium-sized databases such as Oracle, MySQL, Cassandra, and other latency-sensitive applications at lower storage costs compared to gp2.
AWS cost optimization: gp3 and io2 block express EBS Volumes
There are several factors one has to consider before choosing the best EBS volume. Whatever the choice, cost optimization — reducing cloud spending without compromising performance has to be the goal.
Cost and Performance
For applications requiring the highest performance with throughput requirements greater than 16,000 IOPS, the io2 block express volume is the obvious choice. The Max IOPS/Volume volume for the gp3 volume is 16,000 whilst the io2 block express can go as high as 256,000.
Price per provisioned IOPS per month (Performance)
$0.065 up to 32,000 IOPS
$0.046 from 32,001 to 64,000 IOPS
$0.032 > for greater than 64,000 IOPS
For companies that need moderately high performance — where the majority of AWS users fall in — the gp3 is the best EBS volume for them.
They, however, have to make sure that their applications require 16,000 IOPS or less and that the throughput volume doesn’t exceed 1000 MB/s.
Choosing the gp3 for such scenarios results in;
- Significant cost savings. The storage price for gp3 is $0.08/GB-month compared to the io2 block express of $0.125/GB-month. The gp3 also comes with some free IOPS volumes which means companies that select gp3 stand to incur even lesser provisioning costs.
- No drop in performance. The durability differences ( 99.8% — 99.9% for gp3 and 99.999% for io2 block express) are insignificant for the aforementioned performance levels.
Amazon has made migrating from one EBS Volume to another quite easy. It can be done while in an in-use state and result in little or no downtime i.e. without detaching the volume or restarting the instance.
There are two recommended ways of performing the migration.
An existing feature of EBS, Elastic Volume enables you to change EBS volume or type without incurring an additional cost. Your costs however start rising once the newly selected volume starts running. There are however some requirements and limitations which you have to pay attention to.
For example, to migrate to a General purpose SSD volume like gp3 with Elastic Volume, follow the steps below:
i. Open the Amazon EC2 console and select the volume you want to modify
ii. Select the intended volume type, in this case, gp3. You can also adjust the size, IOPS, and throughput within the min-max range provided.
iii. The modifications can take some time to take full effect. To monitor progress, click on the modified volume to see the current state of modification and percentage progress.
You can use the AWS CLI modify-volume command to also change the volume type and size configuration.
For example, to modify a volume to gp3. You can change the existing volume type, size, and IOPS value by running the command below:
The sample output will be:
$ aws ec2 modify-volume --volume-type gp3 --iops 5000 --size 350 --volume-id vol-11111111111111111
You can monitor this modification with the describe-volumes-modifications command. Here’s a sample command:
$ aws ec2 describe-volumes-modifications --volume-ids vol-11111111111111111 vol-22222222222222222
As you can see, the migration was successful without detaching your EBS volumes or restarting your EC2 instances.
NOTE: Not all AWS instance type supports the EBS gp3 in-place migration, in these cases a snapshot and building a new volume/Ec2 instance might be the only solution.
A Note About EKS
AWS Elastic Kubernetes Service has the following requirements for gp3:
- Must be running k8s 1.20 or higher for the latest versions of the ebs-csi EKS AddOn even if AWS documentation mentions 1.70.
- Create a new gp3 storage class, and while you are at it we recommend enabling encryption at rest by default on this new storage class, in the example below we are using the default aws/ebs Kms key but you can specify your own as well.
- class, in the example below we are using the default aws/ebs Kms key but you can specify your own as well.
The Amazon Elastic Block Store (EBS) when used with EC2 can power durable, secure, performant applications with unlimited scale. AWS provides six different EBS volumes provisioned with various benchmarks. Before selecting a volume, companies have to assess their needs to make a well-balanced choice. For most companies, the best choice is the new gp3 EBS volume.