Hands-on Guide: How to migrate from gp2 to gp3 volumes and lower AWS cost

Tal Shladovsky
February 7, 2023
6
min. read
Related Resource(s)

TL;DR

  • gp2 volumes provides a cost-effective way to achieve SSD performance for variety of application, however their performance is tied to the provisioned size, which grows proportionally to the volume size.
  • gp3 volumes provision IOPS and throughput independently, while their top performance is 4 times faster than maximum throughput of gp2 volumes and can be used for all use cases in which gp2 volume are suitable.
  • gp3 provision smaller volumes while maintaining high performance, at a cheaper cost,  
    at up to 20% lower per GB compared to gp2 volumes.
  • Lightlytics offers an easy and scalable way to find and manage EBS volumes with advanced search capabilities and architectural standards.

Intro

In this hands-on guide, we’ll show you how you can migrate your EBS gp2 volumes to gp3 to lower your AWS disk costs by up to 20%.

General Purpose SSD Volumes Overview

General Purpose SSD (gp2) Amazon EBS volumes are a cost-effective way for AWS customers to access SSD performance for a variety of applications, such as virtual desktops, medium-sized databases, development, and testing environments. However, the performance of gp2 volumes is tied to their provisioned size, which increases linearly with the volume size. Increasing volume size comes with increased cost too. This can lead to over-provisioning of storage or performance, which is not cost-effective.
To address this issue, AWS introduced a new Amazon EBS General Purpose SSD volume type, gp3, in December 2020.  
gp3 volumes provide predictable performance of 3,000 IOPS and 125 MiB/s, regardless of volume size.
Additionally, with gp3 volumes, customers can provision IOPS and throughput independently, without increasing storage size, at costs up to 20% less per GB compared to gp2 volumes. Furthermore, gp3 volumes can be scaled up to 16,000 IOPS and 1,000 MiB/s for an additional fee, making it 4 times faster than maximum throughput of gp2 volumes.
By migrating from gp2 volumes to gp3 volumes without restarting instances or detaching volumes, customers can achieve cost reduction on their monthly storage spend.

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):

EBS gp2 to gp3 pricing comparison

You can download the EBS gp2 to gp3 migration cost savings calculator to find out how much you can save by migrating your EBS gp2 volumes to gp3.

So, let’s say you have 100 gp2 volumes having 100 GiB each, you could save up to $130 monthly by migrating from gp2 to gp3:

EBS gp2 to gp3 migration cost saving calculator

How to Find and Migrate gp2 volumes to gp3 volumes

Migrating EBS volumes from gp2 to gp3 can be done via AWS console or AWS CLI without the need to restart your instances or detach your volumes.

Find and Migrate gp2 volumes via AWS Console

To modify an EBS volume using the console:

  1. Open the Amazon EC2 console.
  1. In the navigation pane, choose Volumes.
  1. Identify all gp2 volumes by applying the following filter: “Type = gp2”
  1. Select the volume to modify and choose Actions, Modify volume.
  1. 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:

         a. To modify the type, choose gp3 for Volume Type.

          b. To modify the size, enter a new value for Size.

          c. To modify the IOPS, enter a new value for IOPS.

          d. To modify the throughput, if the volume type is gp3, enter a new value for Throughput.

  1. After you have finished changing the volume settings, choose Modify. When prompted for confirmation, choose Yes.
AWS EC2 console Volumes
Modify volume type
Modify volume details (Size, IOPS and Throughput)

Important notes:

  1. You can’t modify multiple volumes at once.
  1. If you change the volume type from gp2 to gp3, and you do not specify IOPS or throughput performance, Amazon EBS automatically provisions either equivalent performance to that of the source gp2 volume, or the baseline gp3 performance, whichever is higher.  
    For example, if you modify a 500 GiB gp2 volume with 250 MiB/s throughput and 1500 IOPS to gp3 without specifying IOPS or throughput performance, Amazon EBS automatically provisions the gp3 volume with 3000 IOPS (baseline gp3 IOPS) and 250 MiB/s (to match the source gp2 volume throughput).
  1. To select the right size and right performance parameters (IOPS, throughput) that can provide you maximum cost reduction without affecting performance, I recommend reviewing the IOPS and throughput suggested by Sibasankar Behera on his blog post.
  2. (Optional) Before modifying a volume that contains valuable data, it is a best practice to create a snapshot of the volume in case you need to roll back your changes.

Find and Migrate gp2 volumes via AWS CLI

1. Use the describe-volumes command with the --filters option to get a list of all gp2 volumes:

aws ec2 describe-volumes --filters "Name=volume-type,Values=gp2"

2. Use the modify-volume command so you migrate to gp3:

aws ec2 modify-volume --volume-type gp3 --volume-id <volume-id>

Where <volume-id> is the Volume ID that you want to migrate to gp3.

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

aws ec2 modify-volume --volume-type gp3  --iops 4000 --throughput 250  --volume-id <volume-id>

Here is a simple bash script that you can use to change all gp2 volumes to gp3 volumes using the AWS CLI:

#!/bin/bash
#Get all the gp2 volumes
GP2_VOLUMES=$(aws ec2 describe-volumes
--filters "Name=volume-type,Values=gp2" --query 'Volumes[*].{ID:VolumeId}')

#Loop through all the gp2 volumes
for volume in $(echo $GP2_VOLUMES | jq -r '.[] | @base64'); do
       volume=$(echo $volume | base64 --decode)
       VOLUME_ID=$(echo $volume | jq -r '.ID')
       echo "Changing volume $VOLUME_ID to gp3"
       #Change the volume type from gp2 to gp3
        aws ec2 modify-volume --volume-id $VOLUME_ID --volume-type gp3
done

This script uses the AWS CLI command describe-volumes to get a list of all gp2 volumes, and then loops through them, changing the volume type from gp2 to gp3 using the modify-volume command. The script uses jq and base64 to parse the JSON output of the describe-volumes command.

Please note that this script will cause the default values for the IOPS (3000) and throughput (125 MB/s).
Additionally, I recommend that you first test it in a non-production environment, and make sure to take backups before running it.

The New & Easy Way: Find gp2 volumes with Lightlytics

With Lightlytics Architectural Standards you can easily find gp2 volumes to be migrated to gp3, using Lightlytics’s out-of-the-box EBS volumes Cost rules or you can create your own custom rules while using tags and various EBS volume attributes.
By using these capabilities, you can review the total predicted cost of each rule, and the breakdown of cost per violated resource within each rule.

Example architectural standard: Ensure EBS volumes are of type gp3 (General Purpose SSD) instead of gp2
This rule identifies EBS volumes of type gp2. Ensuring that your Amazon EC2 instances are using new General Purpose SSD volumes (gp3) instead of previous General Purpose SSD volumes (gp2) is best practice for cost-effective storage that fits a broad range of workloads.
This rule can help you work align better with the AWS Well-Architected Framework

Screenshot from Lightlytics showing the architectural standard for EBS volumes

This architectural standard’s conditions:

Review rule violations: When there are violations for this rule (or any rule in our architectural standards), this view shows each violated resource including the related predicted cost.

View of the total cost caused by violations of this rule

Detailed look at the total cost of this violation in the Lightlytics UI

Additionally, Lightlytics’s out-of-the-box checks for Provisioned IOPS SSD volumes.
Using new General Purpose SSD (gp3) volumes instead of Provisioned IOPS (PIOPS) SSD is a good strategy for cutting down on AWS costs because for gp SSDs you only pay for the storage compared to PIOPS SSDs where you pay for both storage and IOPS. Converting existing PIOPS-based volumes to gp volumes is possible by configuring larger storage which gives higher baseline performance of IOPS for a lower cost.
Ensure EBS volumes are of type gp3 (General purpose SSD) instead of io1
This rule checks io1 volume type that you could potentially migrate to General Purpose SSD (gp3)

You can create your own custom rules using the rule creation wizard on Lightlytics.
Here’s a custom rule example:
The below custom rule checks for volumes type of gp2 with size greater than 100 and IOPS greater than 600, which are associated to a project called Lightlytics, by using the proper Tag filter.

Summary

This hands-on guide discussed how Amazon EBS gp3 volumes provide a cost-effective option by allowing independent configuration of storage and performance. Migrating from gp2 to gp3 volumes can result in significant cost savings, while also providing more customizable storage and IOPS options for your workload.
Migrating to gp3 volumes with the same size and performance settings as gp2 can be an easy way to reduce costs.
By monitoring EBS gp2 utilization and performance metrics, you can achieve even greater savings on storage costs by properly sizing storage.

Found this useful?

Read Tal's previous blog posts in this series:

Reach out to Tal on LinkedIn if you'd like to suggest other topics, tips & tricks to reduce AWS cost.

What's new