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.
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.
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.
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.
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