Sub topic 5
EBS-optimized instances and instance-level limits
This chapter assumes you know the EBS volume types and their IOPS and throughput limits from the earlier chapters. It also assumes you can run the AWS CLI. It covers the second ceiling on EBS performance: the limit set by the EC2 instance itself.
Why the instance matters
An EBS volume is network-attached storage. Every read and write travels from the instance to the volume over the network. Two limits apply to that traffic:
- The volume limit is the IOPS and throughput that the volume type and its provisioned settings allow.
- The instance limit is the maximum EBS bandwidth, throughput and IOPS that the instance type can drive.
You get the lower of the two. A gp3 volume provisioned for 16,000 IOPS gives you far less than 16,000 IOPS on a small instance type whose EBS limit is lower. This is a common reason for "my fast volume is slow" tickets.
What EBS-optimized means
An EBS-optimized instance has dedicated bandwidth for EBS traffic. That traffic does not compete with the instance's regular network traffic, such as web requests or database client connections.
The behavior depends on the instance generation:
- Nitro-based instances are EBS-optimized by default. The setting is always on, it costs nothing extra, and you cannot turn it off.
- Some older generations (for example C4, M4 and D2) are EBS-optimized by default.
- Some older types support EBS optimization as an option. You enable it at launch, and an additional hourly fee may apply.
- A few very old types do not support it. EBS traffic shares the network interface with everything else on those types.
For new work, choose a current-generation type and you can ignore the switch. The setting still matters when you maintain older fleets.
Reading the limits for an instance type
Each instance type publishes its EBS limits. You can query them instead of searching documentation pages:
aws ec2 describe-instance-types \
--instance-types m5.large \
--query "InstanceTypes[0].EbsInfo"The output looks like this. The numbers are examples, so run the command for your own type and Region.
{
"EbsOptimizedSupport": "default",
"EncryptionSupport": "supported",
"EbsOptimizedInfo": {
"BaselineBandwidthInMbps": 650,
"BaselineThroughputInMBps": 81.25,
"BaselineIops": 3600,
"MaximumBandwidthInMbps": 4750,
"MaximumThroughputInMBps": 593.75,
"MaximumIops": 18750
},
"NvmeSupport": "required"
}The fields mean the following:
| Field | Meaning |
|---|---|
| EbsOptimizedSupport | `unsupported`, `supported` (optional) or `default` (always on) |
| BaselineBandwidthInMbps | Bandwidth the instance can sustain indefinitely |
| BaselineThroughputInMBps | The same baseline expressed as MB/s of throughput |
| BaselineIops | IOPS the instance can sustain indefinitely |
| MaximumBandwidthInMbps, MaximumThroughputInMBps, MaximumIops | Burst ceiling, available for a limited time |
| NvmeSupport | Whether EBS volumes appear as NVMe devices (`required` on Nitro) |
Bandwidth is quoted in megabits per second (Mbps), and throughput in megabytes per second. Divide Mbps by 8 to get MB/s. In the example, 650 Mbps is 81.25 MB/s.
Baseline versus maximum performance
Many smaller instance sizes have a baseline value and a higher maximum value. They can run at the maximum for a limited period and then fall back to the baseline. AWS documents that these instances can sustain maximum performance for at least 30 minutes once every 24 hours.
Larger sizes in the same family usually have equal baseline and maximum values. They have no burst behavior to plan around.
For instance types with burst behavior, CloudWatch publishes EBSIOBalance% and EBSByteBalance%. These show how much burst capacity remains, as a percentage. If the balance sits near 0%, the workload needs a larger instance, not a faster volume.
How the limits combine across volumes
The instance limit is shared by all attached volumes. The instance's total EBS traffic is the sum over its volumes, and that sum is capped at the instance limit.
In the diagram, the volumes together are provisioned for 29,000 IOPS. An instance with an 18,750 IOPS ceiling can use at most 18,750 of them, however busy all three volumes are. Paying for the extra 10,250 IOPS achieves nothing unless you move to a larger instance type.
The same rule applies to throughput. Two st1 volumes cannot together exceed the instance's MB/s limit.
Details that affect the numbers
- I/O size. Instance IOPS figures are quoted for a specific I/O size, commonly 16 KiB for SSD-backed volumes. Larger I/Os consume more of the bandwidth budget per operation, so a workload of large sequential I/O reaches the throughput limit well before the IOPS limit.
- Which limit binds. Divide throughput by I/O size to see which ceiling you hit first. With 256 KiB I/Os, 593.75 MB/s allows about 2,375 operations per second. The IOPS limit is irrelevant there.
- Non-EBS traffic. On Nitro instances, EBS traffic has its own path. Heavy network traffic does not reduce EBS bandwidth, and heavy EBS traffic does not reduce network bandwidth.
- Instance store. Instance store volumes are local to the host and do not count against the EBS limits.
- Volume attributes. The volume's own limits, such as gp3 provisioned IOPS and throughput, still apply on top of the instance limit.
Checking and changing the setting
For an instance type with optional EBS optimization, set it at launch:
aws ec2 run-instances \
--image-id ami-0123456789abcdef0 \
--instance-type m4.large \
--ebs-optimized \
--subnet-id subnet-0123456789abcdef0To change it on an existing instance, stop the instance first:
aws ec2 stop-instances --instance-ids i-0123456789abcdef0
aws ec2 modify-instance-attribute \
--instance-id i-0123456789abcdef0 \
--ebs-optimized
aws ec2 start-instances --instance-ids i-0123456789abcdef0To turn it off again, use --no-ebs-optimized. This works only for types where the setting is optional. On types where EBS optimization is the default, or on Nitro, the call has no useful effect.
Check the current value with:
aws ec2 describe-instances \
--instance-ids i-0123456789abcdef0 \
--query "Reservations[0].Instances[0].EbsOptimized"Diagnosing an instance-level bottleneck
When volume performance is below what you provisioned, work through these checks in order:
- Compare the volume's provisioned IOPS and throughput with the instance type's
MaximumIopsandMaximumThroughputInMBps. If the sum across volumes exceeds the instance limit, the instance is the cap. - Check whether the instance is a burstable-bandwidth size. Look at
EBSIOBalance%andEBSByteBalance%in CloudWatch. A falling or empty balance points to the baseline limit. - Compare the instance-level metrics
EBSReadBytesandEBSWriteBytes(and the matchingEBSReadOpsandEBSWriteOps) against the instance limits. If the totals sit at the limit while each volume's own metrics are below its limit, the instance is saturated. - Look at the volume-level
VolumeQueueLength. A long queue together with flat IOPS suggests a limit is being hit, either on the volume or on the instance. - Decide on the fix: a larger instance size in the same family, a different family with higher EBS bandwidth, or fewer and cheaper volumes if you over-provisioned.
Common errors
- Assuming a volume's provisioned IOPS are always available, without checking the instance type.
- Benchmarking only during the burst window and sizing for the maximum.
- Spreading data across many volumes to get more performance on an instance that is already at its limit.
- Expecting the
--ebs-optimizedflag to add speed on Nitro, where it is already on. - Reading Mbps figures as MB/s, which makes the limit look eight times larger.
Exercise
An instance type has a maximum of 18,750 IOPS and 593.75 MB/s. You attach two gp3 volumes, each provisioned for 12,000 IOPS, and the application issues 16 KiB I/Os against both volumes at full speed. About what IOPS can the instance achieve at most, and what should you check first if you see only about 3,600 IOPS after an hour of steady load?
Show answer
The volumes are provisioned for 24,000 IOPS in total, but the instance caps the combined traffic at 18,750 IOPS. If steady load settles near 3,600 IOPS, check whether this size has a baseline lower than its maximum (the example m5.large has a baseline of 3,600 IOPS) and whether the EBSIOBalance% and EBSByteBalance% metrics have dropped. The instance has likely used its burst time and fallen back to baseline, so a larger instance size is the fix.
Exercise
A Nitro instance reports an EBS bandwidth of 4,750 Mbps. What is that in MB/s, and does heavy web traffic on the instance reduce it?
Show answer
4,750 / 8 is about 593.75 MB/s. On Nitro instances, EBS traffic uses its own dedicated path, so ordinary network traffic does not reduce it.