EBS Auto-Expand
CostLens monitors EC2 disk usage and automatically expands volumes above 80% capacity — no downtime.
CostLens monitors your EC2 disk usage and automatically surfaces a recommendation when any EBS volume exceeds 80% capacity. With one click, CostLens expands the volume and extends the filesystem — no downtime, no data loss, instance keeps running.
How it works
CloudWatch Agent reports disk usage
CloudWatch Agent on your EC2 instance reports disk_used_percent metrics every 5 minutes.
CostLens flags volumes above 80%
CostLens scans these metrics during each analysis run and flags volumes above 80%.
Recommendation card appears
A card appears: "EBS volume vol-xxx is 87% full — expand 100 GB → 120 GB".
Admin or Operator approves
Admin or Operator reviews and clicks Approve & Fix.
CostLens expands the volume
CostLens calls ec2:ModifyVolume to expand the EBS volume live.
Filesystem is extended
Once the volume reaches the new size, CostLens runs growpart + xfs_growfs / resize2fs on the instance via AWS SSM to extend the filesystem.
The instance stays running throughout. AWS expands EBS volumes live. The filesystem extension via SSM takes under 30 seconds and causes no perceptible disruption to running workloads.
Severity levels
| Severity | Threshold |
|---|---|
| critical | ≥ 95% used — disk may fill within hours. Fix immediately. |
| high | ≥ 90% used — review within the day. |
| medium | ≥ 85% used — review within the week. |
| low | ≥ 80% used — plan expansion soon. |
Expansion policy
| Parameter | Value |
|---|---|
| Threshold | 80% disk used |
| Increment | +20% of current size (minimum +5 GB) |
| Cooldown | 6 hours (AWS enforced per volume) |
| Filesystem | Auto-detected: xfs or ext4/ext3 |
Prerequisites
| Requirement | Details |
|---|---|
| CloudWatch Agent on EC2 | Publishes disk_used_percent to the CWAgent namespace. Install with sudo yum install amazon-cloudwatch-agent or via SSM Distributor. |
| SSM Agent on EC2 | Used to run growpart + filesystem extend commands remotely. Pre-installed on Amazon Linux 2+, Ubuntu 16.04+. |
| IAM permissions | ec2:ModifyVolume, ec2:DescribeVolumesModifications, ssm:SendCommand, ssm:GetCommandInvocation |
| EBS volume (not instance store) | Instance store volumes cannot be resized. Most EC2 instances use EBS by default. |
Required IAM permissions
# Add these to your CostLens IAM role policy
ec2:ModifyVolume
ec2:DescribeVolumesModifications
ec2:DescribeInstances
ec2:DescribeVolumes
ssm:SendCommand
ssm:GetCommandInvocation
cloudwatch:ListMetrics
cloudwatch:GetMetricStatistics
These are included in the CostlensApplyFix inline policy from AWS Accounts — Step 4b.
Limitations
| Limitation | Detail |
|---|---|
| Size increase only | EBS volumes can grow but never shrink. AWS does not support live shrink. |
| 6-hour cooldown | AWS blocks a second modification on the same volume within 6 hours of the last one. |
| xfs volumes only grow | xfs (default on Amazon Linux) supports grow but not shrink. ext4 also supported. |
| Disk full = no fix | If the disk is already 100% full, the OS may be unable to run SSM commands. Act before it reaches 100%. |
| CloudWatch Agent required | Default CloudWatch does not report disk space. The CW Agent must be installed and configured. |
Tip
Set up a CloudWatch Agent configuration that reports disk_used_percent for all mount points. Use AWS SSM Distributor to install it across all instances at once — no manual SSH required.