Migrating From gp2 to gp3 Volumes to Lower AWS EBS Costs

Save up to 20% on AWS EBS costs by switching from gp2 to gp3 volumes. This guide shows you how to easily make the change and optimize your expenses.

Patrick Londa
Author
Oct 7, 2022
 • 
 min read
Share this post

Overview of Elastic Block Store and General Purpose Volumes

Amazon Elastic Block Store (EBS) is a block-storage service designed for virtual machines (Amazon EC2). It is an easy-to-use, high-performance solution that provides volumes that can be attached to the EC2 instances. EBS provides several volume types, each optimized for a specific category of workloads. The most popular type, which fits the most workloads, is the general purpose volume. It is backed by solid-state drives and presented by two generations – gp2 and gp3.

Why Migrate from gp2 to gp3 Volumes?

In December 2020, Amazon Web Services (AWS) announced the availability of gp3, the latest version of general purpose SSD volumes for Amazon EBS.

Prior to this, there had been only a linear relationship between EBS volume performance and storage capacity, which led to over-provisioning ⁠and non-cost-effective pricing. Now, with gp3, if you require higher IOPs (input/output operations per second) and throughput, you don’t need to pay for excess storage in addition.

Additionally, when you switch from gp2 volumes to gp3 volumes, you lower your costs by 20%. For example, in the US-East-1 region, gp2 volumes cost $0.10/GiB-month compared to gp3 volumes at $0.08/GiB-month.

With gp3 volumes, you get a baseline performance of 3,000 IOPs and 125MB/s at any volume size, with the ability to scale up to 16,000 input/output operations per second (IOPS) and 1,000 MiB/s for additional fees. With high performance and lower costs, making this switch is easy to justify.

In this guide, we’ll show you how you can switch your gp2 volumes to gp3 to take advantage of the new generation.

Blink Automation: Find and Upgrade AWS EBS Gp2 Volumes
AWS + Slack
Try This Automation

Cost Comparison of gp2 vs gp3 Volumes Across Regions

The table below shows the price differences between gp2 and gp3 volumes in various AWS regions, along with the savings you can achieve by switching to gp3. Use it to quickly assess how much you can save with gp3 based on your region.

Region gp2 Price (per GiB/month) gp3 Price (per GiB/month) Savings
US-East (N. Virginia) $0.10 $0.08 20%
US-West (Oregon) $0.10 $0.08 20%
US-West (N. California) $0.125 $0.10 20%
Canada (Central) $0.11 $0.088 20%
EU (Frankfurt) $0.12 $0.096 20%
EU (London) $0.115 $0.092 20%
EU (Paris) $0.12 $0.096 20%
EU (Ireland) $0.11 $0.088 20%
Asia Pacific (Sydney) $0.14 $0.112 20%
Asia Pacific (Tokyo) $0.125 $0.10 20%
Asia Pacific (Singapore) $0.125 $0.10 20%
Asia Pacific (Mumbai) $0.114 $0.091 20%
Asia Pacific (Seoul) $0.125 $0.10 20%
Middle East (Bahrain) $0.125 $0.10 20%
South America (São Paulo) $0.15 $0.12 20%
Africa (Cape Town) $0.125 $0.10 20%

Additionally, increasing volume performance (IOPS) for gp3 doesn’t require purchasing of additional disk space - baseline performance is 3000 IOPS, and it can be increased separately for 0.005$/IOPS . For example, you need a 300 Gib disk with 4500 IOPS. For gp3 it will cost:

0.08 * 300 + 1500 * 0.005 = 31.5$/month

For gp2, to get 4500 IOPS you will need to increase the disk size to 1500Gib:

1500 * 0.1 = 150$/month

Which gives around 79% of savings. 

Migration Steps

Manual Migration via AWS Console

As with all other administrative operations, migration from gp2 volumes to gp3 can be done via AWS console or AWS CLI. Management of AWS resources using a console is more user-friendly, doesn’t require any skills, and is perfect for single changes, such as a change of volume type for a couple of virtual servers. AWS CLI approach requires some scripting skills and can be used for simple automation and batch jobs. To switch from gp2 volume to gp3 using the AWS console, perform the following steps:

1. Open EC2 console, and navigate to the Volumes under the Elastic Block Store section.

AWS EC2 Dashboard with the Volumes section highlighted under the "Elastic Block Store" category on the left menu.

2. In the search field, enter “type=gp2” to filter the list of the volumes.

AWS EC2 dashboard's Volumes section with a filter applied for volume type selection.

3. In the list of gp2 volumes, select the one you want to modify, then navigate to Actions>Modify Volume.

AWS EC2 Volumes section. A gp2 volume is selected, and the "Actions" dropdown menu is open. The "Modify volume" option is highlighted, allowing changes to the volume configuration.

4. Modify the Volume Type field by selecting the gp3 option from the drop-down list. Optionally, adjust other parameters, such as size, IOPs and throughput. Then, press the Modify button to apply the changes.

Modify volume page in AWS EC2. The volume type is set to "General Purpose SSD (gp3)" with options to change the volume size, IOPS, and throughput.

5. In the confirmation window, select Modify again.

After this, the volume type will change without the need to restart the virtual machine or dismount the volume.

Automating Migration with AWS CLI

To modify the type for all the legacy gp2 volumes, AWS CLI should be used.

1. Open CLI and run the following command to list all the existing gp2 volumes:

aws ec2 describe-volumes --filters Name=volume-type,Values=gp2 --output table --query "Volumes[*].{ID:VolumeId,Size_GiB:Size,State:State,VM:Attachments[0].InstanceId}"

The output will contain a table that shows the volume information:

Terminal output for the DescribeVolumes command.

2. Then, you can run the following script to perform the migration:

GP2_VOLUMES=$(aws ec2 describe-volumes --filters Name=volume-type,Values=gp2 --query "Volumes[*].VolumeId" --output text)
if [ -n "$GP2_VOLUMES" ]; then
    for GP2_VOLUME in $GP2_VOLUMES; do
        aws ec2 modify-volume --volume-id $GP2_VOLUME --volume-type gp3
    done
else
    echo "No gp2 volumes to migrate"
fi

It will return output like this for each volume:

Terminal output detailing a volume modification in progress from gp2 to gp3.

3. To ensure the volume modification was successful, run the command from step 1 again.

Automating gp2 to gp3 Migration with Blink

Switching your gp2 volumes over to gp3 volumes is a simple way to lower your costs, but the process requires manual action on each volume. If you have dozens or hundreds of gp2 volumes, this can be highly time-consuming. And then what happens if an even more cost-effective gp4 volume is announced?

For migrations like these, automation can save you significant time and make these optimizations more feasible at scale.

With Blink, you can run this automation to identify and alert you to any gp2 volumes associated with your EC2 instances. You can then click a button in Slack and migrate that volume to gp3 instead.

Blink Automation: Find and Upgrade AWS EBS gp2 Volumes
Blink Automation: Find and Upgrade AWS EBS gp2 Volumes

Blink Automation: Find and Upgrade AWS EBS gp2 Volumes

When this automation runs, it executes the following actions:

  1. Detects gp2 volumes that are not tagged to ignore.
  2. Asks via Slack whether to upgrade, tag to ignore, or do nothing.
  3. If approved, upgrade each gp2 volume to a gp3 volume.

You can import this automation from the Blink library and customize it however you like.

In Blink, you can also create automation from scratch to meet your team’s unique needs using the hundreds of drag-and-drop actions available from a wide range of tools.

Get started with Blink today and see how easy automation can be.

Preventing Future Usage of gp2 Volumes

As mentioned above, gp2 has no advantages over gp3, it is both more expensive and less productive, so there is no scenario where gp2 volume type is preferable. After migrating all existing gp2 EBS volumes to gp3, you’d probably like to prevent the creation of legacy volumes in your organization. This can be achieved using AWS Service Control Policies (SCP), which are used to manage permissions at the organizational level. In our scenario, we should create a policy that will prevent the running of instances with gp2 volumes:

1. Navigate to the AWS Organizations console. Go to the Policies section and select Service Control Policies.

Policies section in AWS Organizations.

2. On the page that appears, select Enable section control policies.

Service control policies section in AWS Organizations

3. Press the Create Policy button.

Service control policies section in AWS Organizations after enabling SCPs.

4. In the wizard, specify the policy name, then scroll down to the statement field.

Create new service control policy page in AWS Organizations.

5. In the statement field, paste the below JSON-formatted information and select Create Policy.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Preventgp2creation",
            "Effect": "Deny",
            "Action": "ec2:RunInstances",
            "Resource": [
                "arn:aws:ec2:*:*:instance/*"
            ],
            "Condition": {
                "StringEquals": {
                   "ec2:VolumeType": "gp2"
                }
            }
        }
    ]
}
JSON editor for creating a new service control policy in AWS Organizations.

Once the policy is applied, your organization will no longer be able to use instances with legacy volumes, helping prevent wasted AWS resources and ensuring full advantage of gp3 volumes.

Conclusion

Migrating from gp2 to gp3 is a straightforward, cost-effective upgrade. It reduces storage costs by 20% and boosts performance without requiring additional capacity. Automating the process through AWS CLI or tools like Blink can save significant time, especially for larger environments. Once migrated, enforcing policies to prevent future gp2 usage ensures long-term efficiency and cost savings.

FAQ

What are the key performance differences between gp2 and gp3 volumes?

gp2 ties performance to volume size, while gp3 offers more flexibility:

  • gp2: Performance improves as the volume size increases, providing 3 IOPS per GiB, with a max of 16,000 IOPS.
  • gp3: Delivers a fixed 3,000 IOPS, no matter the size, and can scale up to 16,000 IOPS and 1,000 MB/s throughput, making it more consistent.

How does pricing differ between gp2 and gp3, and how can I calculate cost savings?

gp3 is designed to be more cost-efficient while offering better performance options:

  • gp2: Costs $0.10 per GiB per month.
  • gp3: Costs $0.08 per GiB per month, with the ability to scale IOPS and throughput separately, which can reduce costs by up to 20%.

What workloads benefit the most from migrating to gp3?

gp3 is ideal for general purpose workloads without over-provisioning storage - great for databases, virtual desktops, Hadoop clusters, and any application that doesn’t require more than 16000 IOPS..

Can I automate the gp2 to gp3 migration process?

Yes, you can make the migration much easier with automation:

  • Use AWS CLI for scripting and batch-processing migrations.
  • Tools like Blink let you manage multiple migrations with one-click workflows through Slack.

Are there any limitations or scenarios where gp2 might still be a better option?

In some low-demand scenarios, gp2 could still be the right fit:

  • Suitable for environments where occasional burst performance is enough.
  • Works well for small, low-intensity workloads like development or testing.

Generally, gp2 doesn’t have any advantages over gp3, and in almost any case gp3 is the preferable option.

Expert Tip