AWS EBS Volumes gp2 vs gp3, io1 vs io2 which one to choose
Tags: cloud, aws, devops, ebs
Published: 2022-11-19 02:08:49


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/00pbu4xqedcwr9dutw8h.png)

📖 To view the complete course https://www.101daysofdevops.com/courses/100-days-of-aws/
➡️ You can contact me via https://linktr.ee/prashant.lakhera

**What is the problem with gp2?**

To get the most out of your gp2 volume, you must increase your disk size, which is sometimes not cost-effective. In gp2, AWS will default give you 3 Input Output operations(IOPS) per GB(minimum 100IOPS). So if you have 100GB gp2 volume, you will get 300IOPS. They can burst up to 3000IOPS, but you can easily exhaust that limit. On top of that, AWS gives you credit if you are not using these burstable credits over time. So if you have a busy server, you should use all 3000IOPS, leading to your query lag. So to get rid of this issue, you need to increase the disk size, e.g., 1TB, and then you will get 3000IOPS by default.

**Advantages of gp2 over gp3**

1. The advantage of using gp3 is that by default, you will get 3000IOPS. So if you have 100GB gp3 volume, you will get a standard minimum of 3000IOPS. So if you have volume under 1TB switching to gp3 will give you more performance.
2. gp3 is 20% cheaper as compared to gp2. gp2 will cost you ($0.10/GiB-month) vs. gp3 ($0.08/GiB-month) and can scale up to 16000.
3. 3,000 IOPS free, and after that, $0.005/provisioned IOPS/month.
4. gp3 can provide a throughput of up to 1000 MiB/s.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/628fmxgcyhln0068y8t7.png)



Ref: https://aws.amazon.com/blogs/storage/migrate-your-amazon-ebs-volumes-from-gp2-to-gp3-and-save-up-to-20-on-costs/Switching from gp2 to gp3

**Switching from gp2 to gp3 is pretty straightforward**

Go to the EBS console, choose the volume and click on Modify volume.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9mz9is3z9paavgx21cu4.png)



From the drop-down, select gp3

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q0kt0gkyfsntbu0hj6vj.png)



As you can see, by default, it comes with 3000IOPS. Click on Modify.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57ijt00wytuffihd0eea.png)



You will also need to extend the filesystem if you are increasing the volume size.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/16hvzq99kf1bv031djgb.png)



You will see your volume goes into the Available optimizing state


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5eef95kqau5cqvqd43qx.png)


To check the volume status via the command line

`aws ec2 describe-volume-status --volume-ids  <volume id>
To perform the same conversion via aws cli`

`aws ec2 modify-volume --volume-type gp3 -volume-id <vol id>
To modify the volume type, iops and size`

`aws ec2 modify-volume -volume-type gp3 -iops 10000 -size 500 - volume-id <vol-id>`
 
 
🚨🚨 Before you start jumping your guns, here are some things to keep in mind

1. You don't need to stop your instance or detach volume while performing this activity. But based on my experience, this is a long-running operation, especially for bigger volumes(TB in size), and there is a performance impact. Your customer might see slowness or glitches when this operation is happening.
2. 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.
3. The overall performance of the volume is also linked to the instance type it is attached to. So you need more than just increasing the volume to boost your performance. Check the following doc to know more about EBS optimized volume https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-optimized.html

💰💰 Cost difference
⓵ Your use case is you need 10,000 IOPS. If you go with io2, which will give you 500 IOPS per GB, you need 20GB volume. 
📱 20 * 0.125 + 10000 * .065 = 2.50 + 650 = $652.50
If you go with io1 gives you only 50 IOPS per GB. You need 10000/50= 200GB volume
📱 200 * 0.125 + 10000 * .065 = 25 + 650 = $675
🛟 Total savings using io2
675–652.50/675 * 100= 3.33% in cost 💵 saving
🤔 If you are wondering what 0.125 is, it's storage cost, and .065 is provisioned IOPS/month. Check this AWS doc for more info https://aws.amazon.com/ebs/pricing/
Switching from io1 to io2
io2 will give you 500 IOPS per GB as 50 IOPS per GB in io1
io2 volume is more durable 99.999% as compared to io1 99.9%
There is no difference in cost between io2 and io1, but you will see the saving when performing the IOPS calculation

💰💰 Cost difference
⓵ Your use case is you need 10,000 IOPS. If you go with io2, which will give you 500 IOPS per GB, you need 20GB volume. 
20 * 0.125 + 10000 * .065 = 2.50 + 650 = $652.50
If you go with io1 gives you only 50 IOPS per GB. You need 10000/50= 200GB volume
📱 200 * 0.125 + 10000 * .065 = 25 + 650 = $675
🛟 Total savings using io2
675–652.50/675 * 100= 3.33% in cost 💵 saving
🤔 If you are wondering what 0.125 is, it's storage cost, and .065 is provisioned IOPS/month. Check this AWS doc for more info https://aws.amazon.com/ebs/pricing/

**Conversion process is same as gp2 to gp3**

`aws ec2 modify-volume --volume-id <vol-id> --volume-type io2
`
**Reference:**

https://github.com/aws-samples/amazon-ebs-migration-utility

https://aws.amazon.com/blogs/aws/new-ebs-volume-type-io2-more-iops-gib-higher-durability/

https://aws.amazon.com/blogs/storage/migrate-your-amazon-ebs-volumes-from-gp2-to-gp3-and-save-up-to-20-on-costs/

 AWS Cost Calculator calculation https://calculator.aws/#/estimate?id=16616e415037d9bd584fd59fd0f8b5d6c4276b06