How to fix Error: Error creating Kinesis Stream: LimitExceededException in Terraform
This error occurs when AWS Kinesis exceeds account-level or shard-level limits. Common causes include reaching maximum concurrent stream creation, shard quota limits, or API rate limits. Resolving it requires requesting quota increases, optimizing stream configuration, or adjusting Terraform parallelism.
Quick fix
Fixes Error: Error creating Kinesis Stream: LimitExceededException
aws kinesis list-streams --region us-east-1
aws kinesis describe-stream --stream-name your-stream-name --region us-east-1- Check current stream creation status
- Check your shard quota
- Request AWS shard quota increase
- Reduce Terraform parallelism
aws kinesis list-streams --region us-east-1aws kinesis describe-stream --stream-name your-stream-name --region us-east-1Error: Error creating Kinesis Stream: LimitExceededException
What this error means
AWS Kinesis enforces strict quotas and limits to maintain service stability. A LimitExceededException indicates you have exceeded one of these boundaries. This can happen at several levels: creating too many streams simultaneously (max 5 in CREATING state), exceeding your account's total shard limit, hitting API rate limits (5 calls per second for CreateStream), or triggering throughput limits on individual shards (1 MB/s write or 1,000 records/s). Terraform makes rapid API calls, which can trigger these limits faster than manual configuration.
Typical symptoms
- Terraform apply fails when creating Kinesis streams
- Error message contains "LimitExceededException"
- Works on first apply but fails on subsequent operations
- Multiple Terraform operations running in parallel cause errors
Common causes
- More than 5 streams are in CREATING state simultaneously (API allows only 5 concurrent creations)
- Your AWS account has reached the shard limit quota for the region (default limit can be low)
- CreateStream API is being called more than 5 times per second
- Terraform parallelism setting is too high, causing too many concurrent API calls
- Previous streams never finished initializing and are still blocking new creations
How to fix "Error: Error creating Kinesis Stream: LimitExceededException"
First, verify how many streams are currently in the CREATING state using the AWS CLI:
aws kinesis list-streams --region us-east-1
aws kinesis describe-stream --stream-name your-stream-name --region us-east-1Look for streams with status "CREATING". If more than 4 are in this state, wait for them to reach ACTIVE status before creating new streams.
Use the DescribeLimits API to check your current shard quota:
aws kinesis describe-limits --region us-east-1This shows OpenShardCount (current shards) and ShardLimit (your quota). If you're at or near the limit, you need to request a quota increase.
If you've reached your shard limit, request an increase through AWS Service Quotas:
# Open Service Quotas console and navigate to Kinesis
# Search for "Kinesis Data Streams"
# Select "Shard quota"
# Click "Request quota increase"
# Enter your desired shard count
# Submit (usually approved within hours)Alternatively, contact AWS Support for faster processing of quota increases.
Terraform by default parallelizes resource creation. Since Kinesis has a 5 calls/second limit for CreateStream, reduce parallelism:
terraform apply -parallelism=1Or permanently set it in your Terraform code:
terraform {
required_version = ">= 1.0"
}Then apply with explicit parallelism or use the command flag.
Add retry configuration to your AWS Terraform provider to automatically retry rate-limited requests:
provider "aws" {
region = "us-east-1"
retry_mode = "standard"
max_retries = 10
}The standard retry mode includes exponential backoff and will retry rate-limited requests automatically.
Instead of provisioned mode, use On-Demand for variable workloads:
resource "aws_kinesis_stream" "example" {
name = "my-stream"
stream_mode_details {
stream_mode = "ON_DEMAND"
}
}On-Demand mode automatically scales and reduces quota conflicts. It starts with 4 shards and scales automatically, supporting up to 2 GB/s write throughput.
Advanced notes
The 5 concurrent stream creation limit is a hard AWS API constraint that cannot be changed per account. To create many streams, implement a creation queue in your Terraform code using for_each with explicit depends_on to serialize creation. For very large-scale deployments, consider whether Kinesis is the right fit or if you should use a managed streaming service with higher quotas. If you're hitting shard limits repeatedly, audit your partition key distribution to ensure even load across shards, which may reduce your required shard count.
Frequently asked questions
- What does "Error: Error creating Kinesis Stream: LimitExceededException" mean?
- AWS Kinesis enforces strict quotas and limits to maintain service stability. A LimitExceededException indicates you have exceeded one of these boundaries. This can happen at several levels: creating too many streams simultaneously (max 5 in CREATING state), exceeding your account's total shard limit, hitting API rate limits (5 calls per second for CreateStream), or triggering throughput limits on individual shards (1 MB/s write or 1,000 records/s).
- How do I fix "Error: Error creating Kinesis Stream: LimitExceededException"?
- This error occurs when AWS Kinesis exceeds account-level or shard-level limits. Common causes include reaching maximum concurrent stream creation, shard quota limits, or API rate limits. Resolving it requires requesting quota increases, optimizing stream configuration, or adjusting Terraform parallelism.
- What causes "Error: Error creating Kinesis Stream: LimitExceededException"?
- More than 5 streams are in CREATING state simultaneously (API allows only 5 concurrent creations) Your AWS account has reached the shard limit quota for the region (default limit can be low) CreateStream API is being called more than 5 times per second
- Is the "Error: Error creating Kinesis Stream: LimitExceededException" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- ๐Terraform Official Documentation
- ๐
- ๐
- ๐
- ๐
- ๐