WARNING

How to Fix AWS Lambda ThrottlingException (Rate Exceeded)

Quick Fix Summary

TL;DR

Immediately increase your Lambda function's reserved concurrency limit in the AWS Console.

AWS Lambda ThrottlingException occurs when your function's invocation rate exceeds its configured concurrency limits. This is a soft limit imposed by AWS to manage resource allocation across customers.

Diagnosis & Causes

  • Uncapped event source (e.g., S3, SQS) flooding the function.
  • Reserved concurrency limit set too low for the load.
  • Account-level concurrent execution limit reached.
  • Sudden traffic spike without proper scaling.
  • Function errors causing rapid retries from event sources.
  • Recovery Steps

    1

    Step 1: Immediate Mitigation - Increase Reserved Concurrency

    Quickly raise the reserved concurrency for the affected function to stop throttling and allow requests to process. This is the fastest console-based fix.

    bash
    # Navigate to AWS Lambda Console -> Your Function -> Configuration -> Concurrency
    # Under 'Reserved concurrency', click 'Edit'
    # Increase the value (e.g., from 100 to 500) and save.
    2

    Step 2: Diagnose with CloudWatch Metrics & CLI

    Identify the throttle source and pattern using CloudWatch metrics and the AWS CLI to check account and function limits.

    bash
    # Check your account's total concurrent execution limit
    aws lambda get-account-settings --query 'AccountLimit.ConcurrentExecutions'
     
    # Check specific function's concurrent executions and throttles (use CloudWatch)
    # Metric: ConcurrentExecutions, Throttles. Period: 1 minute. Stat: SUM.
    3

    Step 3: Implement a Scalable Architecture with SQS

    For high-volume, variable workloads, decouple using SQS as a buffer. This manages the flow and provides automatic retries with backoff.

    bash
    # 1. Create an SQS Standard Queue.
    # 2. Modify your producer to send messages to SQS instead of invoking Lambda directly.
    # 3. Configure the SQS queue as a Lambda event source with a suitable batch size.
    # 4. Set the SQS trigger's 'Maximum concurrency' on the Lambda to a safe value (e.g., 50).
    4

    Step 4: Proactive Monitoring & Auto-Remediation

    Set up a CloudWatch Alarm to detect rising ConcurrentExecutions and trigger an AWS Lambda function to auto-increase concurrency or scale other resources.

    json
    # CloudWatch Alarm JSON snippet (target ~80% of limit)
    {
      "AlarmName": "Lambda-Concurrency-High",
      "MetricName": "ConcurrentExecutions",
      "Namespace": "AWS/Lambda",
      "Statistic": "Maximum",
      "Period": 60,
      "EvaluationPeriods": 2,
      "Threshold": 800, // 80% of a 1000 limit
      "ComparisonOperator": "GreaterThanThreshold",
      "AlarmActions": ["arn:aws:sns:us-east-1:123456789012:Alert-Topic"]
    }

    Architect's Pro Tip

    "Throttling is per-region. If you're hitting the account limit (default 1000), split workloads across AWS regions or request a limit increase via Support."

    Frequently Asked Questions

    What's the difference between a Throttle and an Error in Lambda?

    A throttle (429) is a managed back-pressure from AWS, failing fast to protect the service. An error (5xx/4xx) originates from your function's code or runtime issue.

    Will increasing reserved concurrency increase my costs?

    Only if the functions are actually invoked more. Reserved concurrency reserves capacity but you pay per invocation and compute time. Unused reservation doesn't incur extra charges.

    How long does it take for a concurrency limit increase to take effect?

    Changes to reserved concurrency are effective immediately. Increases to your account's overall concurrent execution limit via AWS Support can take 24-48 hours.

    Related AWS Guides