I need to increase my AWS Lambda function's concurrency limit so the function doesn't get throttled.
To increase your Lambda function's concurrency limit, you must open a quota increase case in the Service Quotas dashboard.
For more information, see Lambda function scaling and managing concurrency for a Lambda function.
Important: Increasing your concurrency limit can add cost to your AWS account. For more information, see AWS Lambda pricing. Your concurrency limit is shared across all of the functions in your account that are in a specific AWS Region.
Confirm that a concurrency limit increase is required for your use case by verifying the reason why your function is getting throttled
Follow the instructions in How do I troubleshoot Lambda function throttling with "Rate exceeded" and 429 "TooManyRequestsException" errors?
Make sure that you verify you're not exceeding the burst concurrency quota for a particular Region. If you're limited by burst scaling, configure provisioned concurrency for your function instead of increasing your concurrency limit.
Also, make sure that you review your Concurrent executions metric in the Service Quotas dashboard to see your current concurrency usage.
Calculate your required concurrency limit
Important: Make sure that you request a concurrency limit appropriate for your use case. AWS denies requests for high concurrency limits that don't have a valid use case.
Multiply your function's average runtime duration in seconds by the average number of requests (invocations) the function receives per second. The result is your required concurrency limit.
Important: If you're using unreserved concurrency, make sure that the limit isn't higher than the AWS Region concurrency limit.
When calculating your required concurrency limit, keep in mind the following:
- The default concurrency limit per AWS Region is 1,000 invocations at any given time. However, note that new AWS accounts have reduced concurrency and memory quotas.
- The default burst concurrency quota per Region is between 500 and 3,000, which varies per Region.
- There is no maximum concurrency limit for Lambda functions. However, limit increases are granted only if the increase is required for your use case.
- To avoid throttling, it's a best practice to request a limit increase at least two weeks before the increase is needed.
- If you're using Lambda with CloudFront Lambda@Edge in Amazon CloudFront, then you must open a separate quota increase case for each Region.
Example concurrency limit calculation
60 second average function runtime duration x 20 requests on average per second = 1,200 required concurrency limit
Write a description of your Lambda function's use case
Make sure that your request for a concurrency limit increase includes the following details:
- Concurrency limit requested
- Anticipated average number of requests that your function will receive per second
- Anticipated highest number of requests that your function will receive per second
- Anticipated runtime duration
- Function memory size
- Invocation type (event or request-response)
- Event source
- Load test results that explain the reason why the quota increase is needed
- Any additional information that will help us better understand your use case
Open a quota increase case in the Service Quotas dashboard
1. Open the Service Quotas dashboard.
2. Choose the AWS Lambda card. The Lambda Service quotas page opens.
3. Choose Concurrent executions.
4. In the Recent quota increase requests pane, choose the Request quota increase button.
5. Enter your requested concurrency limit. Then, choose Request.
Note: You can also choose the Quota Details button to display the following details:
Previous quota requests
Utilization percentage of your current quota
Alarms and tags associated with your concurrency metrics
Add your Lambda function's use case description to your request
1. Open the Service Quotas dashboard.
2. In the navigation pane, choose Quota request history. A list of your quota requests appears.
3. Find your concurrency limit increase request. Then, choose the Status option next to the quota increase request. The status of your request and the associated support case link appears.
Note: The initial status of a request is Pending. After the status changes to Quota requested, the AWS Support case number appears.
4. Choose the case number to open the ticket for your request.
5. In the ticket's comment thread, add the description of your Lambda function's use case.
Note: You'll receive a status update email from AWS Support that either approves or denies the request. For more information, see Requesting a quota increase.
Operating Lambda: Application design—scaling and concurrency: part 2