AWS EBS Volumes gp2 vs gp3, io1 vs io2 which one to choose
📖 To view the complete course https://lnkd.in/gjeGAPd2
➡️ You can contact me via https://lnkd.in/dePjvNDw
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
- 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.
- 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,000 IOPS free, and after that, $0.005/provisioned IOPS/month.
- gp3 can provide a throughput of up to 1000 MiB/s.
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.
- From the drop-down, select gp3
- As you can see, by default, it comes with 3000IOPS. Click on Modify.
- You will also need to extend the filesystem if you are increasing the volume size.
- You will see your volume goes into the Available optimizing state
- 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
- 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.
- 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.
- 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: