Choosing Between AWS EBS Volumes: gp2 vs. gp3 and io1 vs. io2
If you’re interested in more in-depth explanation of devops topics, please check out my new book “Cracking the DevOps Interview”
Book link: https://pratimuniyal.gumroad.com/l/cracking-the-devops-interview
The Challenges with gp2
When utilizing gp2 volumes on AWS, one common issue is that to increase IOPS, you must expand your disk size, which may not always be economically viable. AWS allocates a default of 3 IOPS per GB for gp2 volumes, with a minimum threshold of 100 IOPS. Consequently, a 100GB gp2 volume receives 300 IOPS but can temporarily burst up to 3000 IOPS. However, this burst capacity can be quickly depleted. AWS compensates for underutilization by accruing credits when these burst capabilities are not employed. In scenarios with high server activity, exhausting all 3000 IOPS can lead to query delays. To address this bottleneck, consider expanding the disk to 1TB, securing 3000 IOPS as the new baseline.
Advantages of gp2 Over gp3
Switching to gp3 volumes introduces several benefits:
- By default, gp3 volumes offer 3000 IOPS, even at the 100 GB baseline, effectively enhancing performance for volumes under 1TB.
- gp3 is approximately 20% less expensive than gp2, at $0.08/GiB-month compared to $0.10/GiB-month. Furthermore, gp3 volumes can scale up to 16,000 IOPS, with the initial 3,000 IOPS included free of charge and additional provisioned IOPS billed at $0.005/month.
- gp3 volumes boast a maximum throughput of up to 1000 MiB/s.
Ref:
Switching from gp2 to gp3 is a straightforward process:
1: Navigate to the EBS console, select the desired volume, and click “Modify volume.”
2: In the drop-down menu, choose gp3 and acknowledge the default 3000 IOPS by clicking “Modify.”
3: Should you increase the volume size, extending the filesystem is necessary.
4: The volume will transition to an “Available optimizing” state.
To monitor the volume status or execute the conversion via the AWS CLI, use the following commands:
- Check volume status:
aws ec2 describe-volume-status --volume-ids <volume id>
- Convert to gp3:
aws ec2 modify-volume --volume-type gp3 --volume-id <volume id>
- To modify volume type, IOPS, and size simultaneously:
aws ec2 modify-volume --volume-type gp3 --iops 10000 --size 500 --volume-id <volume id>
Considerations and Cost Differences
Performing this operation does not require stopping your instance or detaching the volume. However, especially for larger volumes, this can be a lengthy process with potential performance impacts.
The transition might take up to 24 hours to complete, sometimes longer for volumes that haven’t been fully initialized. For instance, a fully utilized 1-TiB volume typically requires around 6 hours to migrate to a new performance configuration, but AWS guarantees that transitional performance will stay within that of the original volume.
Also, the overall performance improvement depends on the instance type to which the volume is attached. For optimal results, ensure your instance supports EBS optimization..
💰💰 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