Sub topic 3
Choosing a volume type
This chapter assumes you know the basics from earlier chapters: what an EBS volume is, how it attaches to an instance in one Availability Zone, and what IOPS and throughput measure. Here you will learn how the six volume types differ and how to pick one for a workload.
Two families, six types
EBS volumes fall into two families.
- SSD-backed volumes are tuned for IOPS. They handle small, random reads and writes well. The types are gp3, gp2, io2 (including io2 Block Express) and io1.
- HDD-backed volumes are tuned for throughput. They handle large, sequential I/O well and cost less per GiB. The types are st1 (Throughput Optimized) and sc1 (Cold).
The API names are gp3, gp2, io2, io1, st1 and sc1. You choose the type when you create the volume, and you can usually change it later with Elastic Volumes, which a later chapter covers.
Comparing the types
The figures below are the documented limits at the time of writing. Quotas and maximums change, so check the EBS documentation before you size a production system.
| Type | Medium | Size range | Max IOPS per volume | Max throughput per volume | Typical use |
|---|---|---|---|---|---|
| gp3 | SSD | 1 GiB to 16 TiB | 16,000 | 1,000 MiB/s | Boot volumes, general databases, most workloads |
| gp2 | SSD | 1 GiB to 16 TiB | 16,000 | 250 MiB/s | Existing volumes, small boot volumes |
| io2 | SSD | 4 GiB to 16 TiB (64 TiB on Block Express) | 64,000 (256,000 on Block Express) | 1,000 MiB/s (4,000 MiB/s on Block Express) | Latency-sensitive, large databases |
| io1 | SSD | 4 GiB to 16 TiB | 64,000 | 1,000 MiB/s | Older provisioned-IOPS volumes |
| st1 | HDD | 125 GiB to 16 TiB | 500 | 500 MiB/s | Big data, log processing, data warehouses |
| sc1 | HDD | 125 GiB to 16 TiB | 250 | 250 MiB/s | Infrequently accessed data at the lowest cost |
The per-volume maximum is only half of the limit. The instance also caps total EBS bandwidth and IOPS, so a volume can never deliver more than the instance allows.
gp3: the default choice
gp3 separates capacity from performance. Every gp3 volume starts with a baseline of 3,000 IOPS and 125 MiB/s, whatever its size. You can provision more of either, up to 16,000 IOPS and 1,000 MiB/s, and you pay only for the extra.
Two ratios limit how far you can push a small volume:
- You can provision up to 500 IOPS per GiB. A 10 GiB volume can reach 5,000 IOPS, and you need at least 32 GiB to reach 16,000.
- You can provision up to 0.25 MiB/s of throughput per provisioned IOPS. To reach 1,000 MiB/s you need at least 4,000 IOPS.
This command creates a gp3 volume with the baseline stated explicitly:
aws ec2 create-volume \
--availability-zone us-east-1a \
--volume-type gp3 \
--size 100 \
--iops 3000 \
--throughput 125 \
--encrypted \
--tag-specifications 'ResourceType=volume,Tags=[{Key=Name,Value=data-vol}]'The --iops and --throughput values here are the defaults, so you could omit them. Spelling them out makes later tuning easier to read in scripts and templates.
gp2: burst credits and the size link
gp2 ties performance to size. A gp2 volume gets 3 IOPS per GiB, with a minimum of 100 IOPS and a maximum of 16,000. A 200 GiB volume therefore has a baseline of 600 IOPS.
Volumes under 1,000 GiB can burst to 3,000 IOPS by spending I/O credits. A volume starts with a full credit bucket of 5.4 million credits. It earns credits at the baseline rate when idle and spends them when demand exceeds the baseline. When the bucket empties, the volume falls back to baseline.
This produces a familiar failure. A small gp2 volume runs fine for days and then slows sharply under sustained load. The BurstBalance CloudWatch metric shows the remaining credits as a percentage. If it drops to zero, the volume is limited to its baseline.
gp3 removes this failure mode and costs about 20% less per GiB than gp2. For most workloads, moving a gp2 volume to gp3 is a low-risk change that you can make while the volume stays attached:
aws ec2 modify-volume \
--volume-id vol-0123456789abcdef0 \
--volume-type gp3The one case to check first is a gp2 volume larger than about 1,000 GiB that relies on a baseline above 3,000 IOPS. After the change it gets the gp3 baseline of 3,000 IOPS unless you provision more, so set --iops explicitly.
io2 and io1: provisioned IOPS
Provisioned IOPS volumes let you buy a guaranteed IOPS figure, independent of size, for workloads that need consistent low latency. You pay for capacity and for each provisioned IOPS.
- io2 supports up to 500 IOPS per GiB and is designed for 99.999% durability. Standard gp and HDD volumes are designed for 99.8% to 99.9%. io2 Block Express, available on supported Nitro instances, raises the limits to 256,000 IOPS, 4,000 MiB/s and 64 TiB, with sub-millisecond latency.
- io1 supports up to 50 IOPS per GiB and the older durability figure. For new workloads, io2 generally costs the same per GiB and per IOPS but has higher durability and a better IOPS-to-size ratio, so prefer it.
Choose provisioned IOPS only when you need what gp3 cannot give you. That means more than 16,000 IOPS or 1,000 MiB/s on one volume, the highest durability, sustained sub-millisecond latency, or Multi-Attach (covered in a later chapter).
st1 and sc1: HDD volumes
HDD volumes cannot be boot volumes, and the minimum size is 125 GiB. Their performance depends on size and uses a burst bucket measured in throughput rather than IOPS:
| Type | Baseline per TiB | Burst per TiB | Volume maximum |
|---|---|---|---|
| st1 | 40 MiB/s | 250 MiB/s | 500 MiB/s |
| sc1 | 12 MiB/s | 80 MiB/s | 250 MiB/s |
A 4 TiB st1 volume has a baseline of 160 MiB/s. The IOPS figures (500 for st1, 250 for sc1) count large I/Os of 1 MiB, so a workload of small random reads performs badly on HDD. Use st1 for large sequential scans and sc1 for data you rarely touch. If the workload is mixed or unpredictable, use gp3.
A decision path
Sizing in practice
Work from requirements, not from the type name.
- Measure or estimate peak IOPS, peak throughput and I/O size. Throughput is roughly IOPS multiplied by I/O size.
- Check the instance limits. A volume rated at 16,000 IOPS gains nothing on an instance that caps EBS at 10,000.
- Start with gp3 at the baseline and raise IOPS or throughput only when CloudWatch shows the volume at its limits.
- Move to io2 only when a measured need rules out gp3.
Common errors
- A new gp3 request is rejected. The IOPS or throughput exceeds the ratio for the size. Check the 500 IOPS per GiB and 0.25 MiB/s per IOPS limits.
- An HDD volume will not boot. st1 and sc1 cannot be boot volumes. Use gp3 for the root volume and HDD for data.
- A volume is slow despite a fast type. Check the instance's EBS limits, and check whether the volume is a restored snapshot that has not been initialized.
- A gp2 volume slows after days of load. Its burst credits ran out. Check
BurstBalanceand move to gp3.
Exercise
A database needs 12,000 IOPS and 400 MiB/s on a 150 GiB volume. Can a single gp3 volume do this, and what would you provision?
Show answer
Yes. Provision 12,000 IOPS and 400 MiB/s. The IOPS figure is under the 16,000 maximum and the size supports it, because 150 GiB allows up to 75,000 IOPS at 500 IOPS per GiB. The throughput is under the 1,000 MiB/s maximum and under the 0.25 MiB/s per IOPS limit, which allows 3,000 MiB/s at 12,000 IOPS. Also confirm that the instance's EBS limits are at least this high.
Exercise
A 300 GiB gp2 volume handles a sustained 2,000 IOPS workload and has slowed down. What is its baseline, why did it slow, and what is the simplest fix?
Show answer
The baseline is 900 IOPS (3 IOPS per GiB times 300 GiB). The workload exceeds the baseline, so it spent its burst credits, and once they ran out the volume dropped to 900 IOPS. The simplest fix is to change the volume type to gp3 with modify-volume, which gives a 3,000 IOPS baseline with no burst credits.