Migrate your Amazon EBS volumes from gp2 to gp3 and save up to 20% on costs

Migrate your Amazon EBS volumes from gp2 to gp3 and save up to 20% on costs

General Purpose SSD (gp2) Amazon EBS volumes have provided a cost effective way for AWS customers to achieve SSD performance for variety of applications, such as virtual desktops, medium-sized databases, development, and testing environments. Amazon EBS gp2 volumes are simple to use, but their performance is coupled with provisioned size that increases linearly with the volume size. Certain applications, such as MySQL, Cassandra, and Hadoop clusters, require high performance but not high storage capacity, and would require customers to provision bigger gp2 volumes to get higher performance. This can lead to over-provisioning of storage or performance in some cases, which is not cost effective.

In December 2020, AWS announced general availability of a new Amazon EBS General Purpose SSD volume type, gp3. AWS designed gp3 to provide predictable 3,000 IOPS baseline performance and 125 MiB/s, regardless of volume size. With gp3 volumes, you can provision IOPS and throughput independently, without increasing storage size, at costs up to 20% lower per GB compared to gp2 volumes. This means you can provision smaller volumes while maintaining high performance, at a cheaper cost. Customers looking for even higher performance can scale up to 16,000 IOPS and 1,000 MiB/s, for an additional fee. The top performance of gp3 is four times faster than maximum throughput of gp2 volumes, and you can use gp3 volumes for all use cases in which gp2 volume were suitable.

In this blog post, I cover how to seamlessly migrate from gp2 volumes to gp3 volumes without restarting your instances or detaching your volumes. By doing so, you can gain cost reduction on your monthly storage spend, and by using Cost Explorer or Cost and Usage Reports, you can understand your monthly spend on Amazon EBS gp2 and the overall monthly cost reduction achievable through such a  migration.

Comparing Amazon EBS volume types gp2 and gp3

Here is a quick comparison of cost between gp2 and gp3 volumes in the us-east-1 (N. Virginia) Region (detailed pricing examples are available here):

Volume typegp3gp2
Volume size1 GiB – 16 TiB1 GiB – 16 TiB
Baseline IOPS30003 IOPS/GiB (minimum 100 IOPS) to a maximum of 16,000 IOPSVolumes smaller than 1 TiB can also burst up to 3,000 IOPS.
Max IOPS/volume16,00016,000
Baseline throughput125 MiB/sThroughput limit is between 128 MiB/s and 250 MiB/s, depending on the volume size.
Max throughput/volume1,000 MiB/s250 MiB/s
Price$0.08/GiB-month3,000 IOPS free and$0.005/provisioned IOPS-month over 3,000;125 MiB/s free and$0.04/provisioned MiB/s-month over 125MiB/s$0.10/GiB-month

How to migrate from gp2 to gp3

Amazon EBS Elastic Volumes enable you to modify your volume type from gp2 to gp3 without detaching volumes or restarting instances (requirements for modification), which means that there are no interruptions to your applications during modification.

To modify an Amazon EBS volume using the AWS Management Console

  1. Open the Amazon EC2 console.
  2. Choose Volumes, select the volume to modify, and then choose ActionsModify Volume.
  3. The Modify Volume window displays the volume ID and the volume’s current configuration, including type, size, IOPS, and throughput. Set new configuration values as follows:
  • To modify the type, choose gp3 for Volume Type.
  • To modify the size, enter a new value for Size.
  • To modify the IOPS, enter a new value for IOPS.
  • To modify the throughput, if the volume type is gp3, enter a new value for Throughput.
  • After you have finished changing the volume settings, choose Modify. When prompted for confirmation, choose Yes.

If you increase the volume size, you must also extend the volume’s file system to make use of the new storage capacity. For more information, see the documentation on extending a Linux file system after resizing a volume. To migrate to gp3, you do not need to increase the volume size.

It might take up to 24 hours for a new configuration to take effect, and in some cases more, such as when the volume has not been fully initialized. Typically, a fully used 1-TiB volume takes about 6 hours to migrate to a new performance configuration. Transitional volume performance will be no less than the source volume performance. If you are downgrading IOPS, transitional volume performance is no less than the target volume performance. For more information, see the documentation on monitoring the progress of volume modifications.

Modify an EBS volume using Elastic Volumes (AWS CLI)

Use the modify-volume command to migrate to gp3. The following is an example command to migrate an 8-GiB gp2 volume to gp3 with baseline performance.

aws ec2 modify-volume --volume-type gp3 -volume-id vol-11111111111111111

Following is an example output.

{
    "VolumeModification": {
        "VolumeId": "vol-11111111111111111",
        "ModificationState": "modifying",
        "TargetSize": 8,
        "TargetIops": 3000,
        "TargetVolumeType": "gp3",
        "OriginalSize": 8,
        "OriginalIops": 100,
        "OriginalVolumeType": "gp2",
        "Progress": 0,
        "StartTime": "2021-02-03T13:38:08+00:00"
    }
}

The following is an example command to modify a 10-GiB gp2 volume to gp3 and configure specific IOPS and throughput.

aws ec2 modify-volume --volume-type gp3  --iops 4000 --throughput 250  --volume-id vol-11111111111111111

The following is the example output of the preceding command.

{
    "VolumeModification": {
        "VolumeId": "vol-11111111111111111",
        "ModificationState": "modifying",
        "TargetSize": 10,
        "TargetIops": 4000,
        "TargetVolumeType": "gp3",
        "TargetThroughput": 250,
        "OriginalSize": 10,
        "OriginalIops": 100,
        "OriginalVolumeType": "gp2",
        "Progress": 0,
        "StartTime": "2021-02-03T13:52:47+00:00"
    }
}

What IOPS and throughput should you select while migrating to gp3?

When provisioning a gp2 volume, you must figure out the size of the volume in order to get the proportional IOPS and throughput. Now with gp3, you don’t have to provision a bigger volume to get higher performance. You can choose your desired size and performance as per your application need. Selecting the right size and right performance parameters (IOPS, throughput) can provide you maximum cost reduction, without affecting performance.

A short and simple table to help you with gp3 configuration options:

Volume sizeIOPSThroughput
1–170 GiB3000125 MiB/s
170–334 GiB3000125 MiB/s if the chosen EC2 instance type supports 125MiB/s or less, use higher as per usage, Max 250 MiB/s*.
334–1000 GiB3000125 MiB/s if the chosen EC2 instance type supports 125MiB/s or less, Use higher as per usage, Max 250 MiB/s*.
1000+ GiBMatch gp2 IOPS (Size in GiB x 3) or Max IOPS driven by current gp2 volume125 MiB/s if the chosen EC2 instance type supports 125MiB/s or less, Use higher as per usage, Max 250 MiB/s*.

*Gp3 has capability to provide throughput up to 1000 MiB/s. Since gp2 provide a maximum of 250MiB/s throughput, you may not need to go beyond this limit when you migrate to gp3.

Understanding the performance boundaries of a gp2 volume

The performance configuration of a gp2 volume is determined by it’s size. The overall performance of the volume is also linked to the instance type it is attached to. In this section, I dive deep into the performance boundaries of a gp2 volume and how the instance type also influences the performance. This will help you select the appropriate configuration options on a gp3 volume to get the maximum cost reduction from a migration.

IOPS

Baseline performance of a gp2 volume scales linearly, at 3 IOPS per GiB of volume size, with a minimum of 100 IOPS (at 33.33 GiB and below), a maximum of 16,000 IOPS (at 5,334 GiB and above), and also the ability to burst to 3,000 IOPS.

The following table illustrates baseline and burst IOPS for gp2 volumes.

GP2 volume size in GiBBaseline IOPSBurst IOPS
301003000
1003003000
50015003000
10003000
20006000
600016000

Gp3 provides a baseline of 3000 IOPS. Without any additional fee for IOPS, you can safely configure any workload that used a gp2 volume up to 1000 GiB with a gp3 volume.

If the volume size is greater than 1000 GiB, you can check the actual IOPS driven by the workload and choose a corresponding value. For example, if you need a 2000 GiB gp2 volume for storage size, and did not need 6000 baseline IOPS performance, you now have ability to have the same storage size while configuring the volume with lower IOPS. If you want to avoid any performance risk and simply want to have similar IOPS as gp2, you can go ahead with the baseline formula of gp2. For this example, for a 2000 GiB gp3 volume, select 6000 IOPS.

Throughput

For gp2, the throughput limit is between 128 MiB/s and 250 MiB/s, depending on the volume size. Volumes smaller than or equal to 170 GiB deliver a maximum throughput of 128 MiB/s. Volumes larger than 170 GiB but smaller than 334 GiB deliver a maximum throughput of 250 MiB/s, if burst credits are available. Volumes larger than or equal to 334 GiB deliver 250 MiB/s regardless of burst credits.

For smaller gp3 volumes, sized up to 170 GiB, like root volumes, you can use default baseline throughput, 125 MiB/s. For bigger volumes, or volumes that require more throughput, you can match the throughput limit of a gp2 volume as described previously. This article explains how to calculate throughput on existing Amazon EBS volumes.

Important: With Amazon EBS, throughput also depends on the instance type that you attach the volume to. For example, you can get 250 MiB/s throughput when you have attached the gp2 volume to an instance type that provides similar or higher EBS bandwidth. So, select higher throughput than the baseline for gp3 volume type when the workload requires and supported by the instance type.

Cost comparison between gp2 and gp3 in the us-east-1 (N. Virginia) Region

gp2gp3 – at baseline configurationgp3 – at gp2 matching configuration
Size of the volume in GiBMax IOPSThroughput (MiB/s)Cost (USD/month)IOPSthroughput (MiB/s)Cost (USD/month)Cost reduction compared to gp2IOPSThroughput (MiB/s)Cost(USD/month)Cost reduction compared to gp2
3030001283.0030001252.4020%30001282.5216%
100300012810.0030001258.0020%30001288.1219%
500300025050.00300012540.0020%30002504510%
10003000250100.00300012580.0020%30002508515%
20006000250200.003000125160.0020%600025018010%
600016000250600.003000125480.0020%160002505508%

Volumes over-provisioned for higher IOPs

What about the Amazon EBS gp2 volumes over-provisioned for higher IOPs?

Until now, I focused on migrating from Amazon EBS gp2 volumes to gp3 volumes with same storage size, but adjusting IOPs and throughput as per your application needs. The reason for this is that Amazon EBS Elastic Volumes enable you to increase volume size, change volume type, and adjust performance (IOPs, throughput) without detaching the volume or restarting the instance for supported instance types.

Amazon EBS Elastic Volumes do not support reducing volume size. There may be cases where you have provisioned larger Amazon EBS gp2 volumes for higher IOPs. For these volumes, cost savings can be higher than 20% by using a smaller gp3 volume with a higher performance configuration. For example, if your workload requires 6000 IOPs, you provision a 2000 GiB gp2 volume and you only need 1000 GiB of storage space. In N. Virginia, the cost of a 2000 GiB gp2 volume is 200.00 USD/month. Now, you can provision a 1000 GiB gp3 volume with 6000 IOPs (and 250-MB/s throughput to match to gp2) and pay only 100 USD/month, which is 50% cheaper than the 2000 GiB gp2 volume, and still enables the same application performance. Since Elastic Volumes don’t support reducing volume size, migrating from gp2 to gp3 volumes will require you to create a smaller volume and migrate the data to the gp3 volume using an application-level tool like rsync.

Conclusion

In this blog post, I covered how Amazon EBS gp3 volumes enable you to configure storage and performance independently, making them more cost-effective than gp2 volumes. Migrating from gp2 to gp3 volumes opens up large cost optimization opportunities, and enables more optimal and customizable configuration of storage and IOPs, as required by your workload. Volumes smaller than 1000 GiB get sustained performance and reduced cost with gp3, compared to burstable performance on gp2. Migrating to gp3 volumes, while keeping the same size and performance configurations as gp2, can be the easiest way to get a quick cost reduction. With little additional effort of monitoring your EBS gp2 utilization and performance metric, you can achieve higher savings on storage cost by effective storage right sizing.

Techmandra Avatar

Leave a Reply

Your email address will not be published. Required fields are marked *