Cloud Cost Optimization with Minimal Effort: Migrate AWS EBS GP2 to GP3

This blog was originally published on Medium, March 31, 2023

This blog series aims to help optimize AWS cloud infrastructure costs with minimal to no effort from Engineering teams. This blog brings everything you need to know about AWS EBS volume types, when to use gp2 vs gp3, how to migrate from gp2 to gp3 to save 20% on your EBS volume potential costs.

What are EBS Volumes?

There are several types of EBS volumes, including:

  • Solid state drives (SSD) — Optimized for transactional workloads involving frequent read/write operations with small I/O size, where the dominant performance attribute is IOPS.
  • Hard disk drives (HDD) — Optimized for large streaming workloads, the dominant performance attribute is throughput.
  • Previous generation/Magnetic — Hard disk drives that can be used for workloads with small datasets where data is accessed infrequently, and performance is not of primary importance.

Gp3 (general purpose SSD) volumes make it easy and cost-effective for customers to meet the IOPS and throughput requirements for transaction-intensive workloads, such as virtual desktops, test and development environments, low-latency interactive applications, and boot volumes. With existing general-purpose SSD (gp2) volumes, performance is tied to storage capacity, enabling customers to get higher IOPS and throughput for their applications by providing a larger storage volume. But customers want to scale performance and throughput without paying for storage they don’t need.

Next-generation gp3 volumes offer the ability to independently provision IOPS and throughput, separate from storage capacity. This enables customers to scale performance for transaction-intensive workloads without needing to provision more capacity, so they only pay for the resources they need.

Benefits of gp3

AWS EBS gp2 vs gp3 Volumes

Consider the baselines offered by both, and you may want to pick and choose between volumes.

Note: If you do not see the 20% savings straight away, that means you’re using more throughput or IOPS (you could customizable for gp3)

Source: AWS Blog

How to Migrate From gp2 to gp3

AWS 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.

Using Infrastructure as Code

If you use Terraform to provision and manage EBS volumes, changing the type is as simple as changing the string from gp2 to gp3.

If you are using ASG Auto Scaling Groups and the aws/autoscaling or aws/autoscaling_mixed_instance_policy Terraform modules, you need to add 2 lines of code!

  • root_volume_type = “gp3” changes the volume type of your root partition
  • ebs_volume_type = “gp3” changes the volume type of your /mnt partition

If you have EC2 instances declared in Terraform, your code might look like this for change:

module “account_tags” {
  resource “aws_instance” “instance_with_volume_inline” {
  ami = “ami-0xxxxxxx”
  instance_type = “t3.medium”
  subnet_id = “subnet-xxxxxxxx”
  root_block_device {
    volume_type = “gp3” # Easy to change
    volume_size = 80
  }
}

Note: Terraform change doesn’t affect any existing resources. It will only be applied to new instances your ASG creates after your terraform change.

Using the AWS Management Console

Here’s a series of steps to modify an Amazon EBS volume through the AWS Management Console

  • Open the Amazon EC2 console.
  • Choose Volumes, select the volume to modify, and then choose Actions, Modify Volume.
  • The Modify Volume window displays the volume ID and 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 use 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.

Using the AWS CLI

You could also use the AWS CLI command to change the volume type from gp2 to gp3

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

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. A fully used 1-TiB volume typically takes about 6 hours to migrate to a new performance configuration. Transitional volume performance will be no less than the source volume performance. Transitional volume performance is no less than the target volume performance if you downgrade IOPS. For more information, see the documentation on monitoring the progress of volume modifications.

What IOPS and Throughput Should You Select While Migrating to gp3?

Source: AWS Blog

When provisioning a gp2 volume, you must determine the volume size 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 with maximum cost reduction without affecting performance.

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

Note: gp3 can provide a throughput of up to 1000 MiB/s. Since gp2 provides a maximum of 250MiB/s throughput, you may not need to go beyond this limit when you migrate to gp3.

See Understanding the performance boundaries of a gp2 volume for information on gp2 limitations.

Is This a Safe Change?

Yes, this change allows you to add more throughput to your EBS volumes like you extend your storage on EBS volumes.

  • This change does not affect how you access your EBS volume storage/how you extend your storage.
  • This change makes no difference in how your OS sees your storage.
  • Even though AWS suggests that this modification can be done to existing EBS GP2 volumes- to increase safety further, we suggest no in-place modifications are made. We rely on rolling the fleet via Infrastructure as code to perform the upgrades.

While AWS assures us that this process is extremely safe, we ask service owners to test this in their Dev/Sandbox Environments first and then roll it out to Prod if everything looks good.

Conclusion

To sum up, it’s highly recommended that you upgrade your EBS volumes to GP3. Performing upgrades such as these allow your application to become more performant while increasing efficiency and also potentially reducing 20% in storage costs. Additional benefits of upgrading include gp3 speed and IOPS customization, along with Burstable capacity that has been increased by 4x.

Additional references

Thank you for reading this! Please feel free to connect with me on Linkedin with any questions.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

Join us and stay in touch

Scroll to Top

Get In Touch Today