The EBS VolumeLimitExceeded error occurs when you've reached AWS account or regional limits for EBS volumes. This can be resolved by deleting unused volumes or requesting a service quota increase through AWS.
The VolumeLimitExceeded error indicates that your AWS account has reached the maximum number of EBS volumes allowed in a specific region or for a particular volume type. Each AWS account has service quotas that limit the number of active EBS volumes, storage capacity, and IOPS provisioning per region. When Terraform attempts to create an EBS volume and hits this limit, AWS rejects the request, causing EC2 instances to fail to launch. The error message may appear as "State transition reason: Client.VolumeLimitExceeded: Volume limit exceeded" when you check the failed EC2 instance in the AWS console. These limits exist to help AWS prevent resource exhaustion and manage service capacity. The good news is that AWS can automatically increase your quotas based on your usage patterns, and you can also manually request quota increases.
First, confirm that the error is indeed VolumeLimitExceeded by checking the EC2 instance state reason in the AWS console:
1. Navigate to EC2 Dashboard > Instances
2. Find the failed instance (usually in 'terminated' state)
3. Check the "Instance State Transition Reason" field
4. You should see: "Client.VolumeLimitExceeded: Volume limit exceeded"
Alternatively, use the AWS CLI to inspect the instance:
aws ec2 describe-instances --instance-id <instance-id> --query 'Reservations[0].Instances[0].StateTransitionReason'This confirms whether the error is volume-related before proceeding with fixes.
The quickest fix is to remove unneeded EBS volumes:
1. Navigate to EC2 Dashboard > Elastic Block Store > Volumes
2. Filter for volumes in your target region
3. Select volumes that are not "in-use" (unattached volumes)
4. Right-click > Delete Volume
You can also delete via AWS CLI:
# List all available volumes in a region
aws ec2 describe-volumes --region us-east-1 --query 'Volumes[?State==`available`].{Id:VolumeId,Size:Size,Type:VolumeType}'
# Delete a specific volume
aws ec2 delete-volume --volume-id vol-1234567890abcdef0 --region us-east-1Deleting unused volumes immediately frees up quota for new volumes.
If you need more volumes, request a quota increase through the AWS Service Quotas console:
1. Go to https://console.aws.amazon.com/servicequotas/home/services/ec2/quotas/
2. Select your target region from the top-right dropdown
3. Search for quota names like:
- "Storage for General Purpose SSD (gp2) volumes"
- "Storage for General Purpose SSD (gp3) volumes"
- "Number of EBS volumes"
- "IOPS for Provisioned IOPS SSD (io1) volumes"
4. Click the quota name
5. Click "Request quota increase"
6. Enter your desired value
7. Click "Request"
AWS typically processes quota increase requests within a few minutes. You can also use the AWS CLI:
# Get current quota for gp2 volumes
aws service-quotas get-service-quota --service-code ebs --quota-code L-C18FBD6D --region us-east-1
# Request an increase
aws service-quotas request-service-quota-increase --service-code ebs --quota-code L-C18FBD6D --desired-value 150 --region us-east-1If you have legitimate needs for more volumes, update your Terraform code:
Option 1: Verify volume_type is set correctly
resource "aws_ebs_volume" "example" {
availability_zone = "us-east-1a"
size = 100
type = "gp3" # Explicitly set to gp3 instead of defaulting to io1
tags = {
Name = "example-volume"
}
}Option 2: Spread resources across regions
# Instead of creating all volumes in one region, distribute across regions
resource "aws_ebs_volume" "example" {
for_each = toset(["us-east-1a", "eu-west-1a"])
availability_zone = each.key
size = 100
type = "gp3"
tags = {
Name = "example-volume-${each.key}"
}
}Option 3: Use lifecycle policies to clean up old volumes
resource "aws_ebs_volume" "example" {
availability_zone = "us-east-1a"
size = 100
type = "gp3"
tags = {
Name = "example-volume"
}
lifecycle {
prevent_destroy = false # Allow Terraform to delete if needed
}
}Once you've deleted unused volumes or your quota increase is approved, re-run Terraform:
# Refresh your plan to see current AWS state
terraform plan
# Apply the configuration
terraform applyIf you were deleting volumes manually, Terraform may try to destroy/recreate resources. Use terraform import to sync state if needed, or use terraform state rm to remove resources that no longer exist in AWS.
Quota Auto-Scaling: AWS monitors your EBS usage and can automatically increase your soft quotas (non-adjustable limits cannot be auto-increased). If you maintain consistent high usage, AWS may preemptively raise your limits.
Hard vs Soft Limits: Some limits are soft quotas (requestable), while others are hard limits that cannot be increased. For example, the maximum of 2500 volumes per instance in certain regions is a hard limit. However, the per-account/region storage limit is a soft quota you can increase.
Volume Attachment Limits: Be aware that instances have volume attachment limits. Nitro-based instances support up to 28 EBS attachments, while older instances may support fewer.
Spot Instances: If using spot instances, be aware that quotas still apply. Terminating a spot instance doesn't immediately free quota—quota is freed when the volume enters the "available" state.
Regional Awareness: Quotas are per-region. A quota increase in us-east-1 does not affect us-west-2. Plan your regional strategy accordingly when scaling infrastructure.
Error: Error installing helm release: cannot re-use a name that is still in use
How to fix "release name in use" error in Terraform with Helm
Error: Error creating GKE Cluster: BadRequest
BadRequest error creating GKE cluster in Terraform
Error: External program failed to produce valid JSON
External program failed to produce valid JSON
Error: Unsupported argument in child module call
How to fix "Unsupported argument in child module call" in Terraform
Error: network is unreachable
How to fix "network is unreachable" in Terraform