Free auditStart free
GuideError · CDN and hosting

AWS Lambda timeout

Fix an AWS Lambda timeout: the 3 second default, the 900 second limit, console and CLI steps to raise it, memory and init fixes, retries and load balancer 502s.

3 min
read
5
sources
Oct 23, 2026
updated
Scaplet Editorial Team
author
In one line

A Lambda timeout means your function ran longer than its configured timeout and Lambda stopped it. AWS's troubleshooting guide shows the error as "Task timed out after 3.00 seconds". The timeout defaults to 3 seconds and can be set from 1 to 900 seconds (15 minutes). Raise it, add memory, trim init code, and make any caller wait longer than the function.

30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
01Timeout facts from the AWS docs

What the Lambda timeout is

Timeout is the maximum number of seconds a Lambda function can run. AWS's docs give the default as 3 seconds, adjustable in increments of 1 second up to a maximum of 900 seconds (15 minutes). For functions on Lambda Managed Instances, asynchronous invocations and event source mappings (except Amazon MQ and Amazon DocumentDB) allow up to 5,400 seconds (90 minutes).
Item

Default

Value
3 seconds
Item

Maximum

Value
900 seconds (15 minutes)
Item

Maximum, Managed Instances with async or event source mapping invocations

Value
5,400 seconds (90 minutes)
Item

Example error in the AWS troubleshooting guide

Value
Task timed out after 3.00 seconds

Common causes AWS lists: downloads from Amazon S3 that are larger or slower than average, a call to another service that takes longer to respond, and parameters that need more computation. AWS also notes that a timeout close to your average duration risks unexpected timeouts, and that tests should use realistic data sizes, not small samples.

02How it works

Fix a Lambda timeout

AWS CLI: set a 2 minute timeout
aws lambda update-function-configuration \
  --function-name my-function \
  --timeout 120
AWS SAM template.yaml
Resources:
  my-function:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: .
      MemorySize: 128
      Timeout: 120
  1. 01

    Raise the timeout

    In the Lambda console, open the function, choose Configuration > General configuration > Edit, set Timeout between 1 and 900 seconds, and Save.

  2. 02

    Give it more memory

    AWS says more memory also means proportionally more CPU, which can speed up both the Init and Invoke phases.

  3. 03

    Shorten initialization

    If the log shows Sandbox.Timedout, the Init phase timed out. AWS says Lambda then re-runs Init on the next invoke (a suppressed init), which with a short timeout of around 3 seconds may not finish. Reduce the init code, or raise the timeout.

  4. 04

    Fix the slow call

    Time the S3 download or downstream call with logs to see which step takes the time.

03Explained

Retries, callers and 502s

By default, when an asynchronous invocation returns an error, Lambda tries two more times, with a one-minute wait between the first two attempts and two minutes between the second and third. AWS counts runtime errors such as timeouts as function errors. For throttling (429) and 500-series errors, Lambda requeues the event for up to 6 hours by default. Configure a dead-letter queue or an on-failure destination to capture failed events, and make the function safe to run twice on the same event.

A synchronous caller has its own limit. For an Application Load Balancer with a Lambda target, AWS lists a 502 when the function did not respond before its configured timeout, or returned an error or was throttled, and a 504 when the Lambda service did not respond before the connection timeout. Keep the function timeout shorter than the caller's, and see AWS 502 Bad Gateway, 502 Bad Gateway and 504 Gateway Timeout. For the SEO side of 5xx responses, see 5xx server errors.

Related errors: API Gateway 504, Netlify function timeouts, Vercel function timeouts.

Sources · 5

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • amazon.com
  • google.com
  1. 01Configure Lambda function timeout (AWS docs)docs.aws.amazon.com · checked 2026-10-25
  2. 02Troubleshoot invocation issues in Lambda (AWS docs)docs.aws.amazon.com · checked 2026-10-25
  3. 03How Lambda handles errors and retries with asynchronous invocation (AWS docs)docs.aws.amazon.com · checked 2026-10-25
  4. 04Troubleshoot your Application Load Balancers (AWS docs)docs.aws.amazon.com · checked 2026-10-25
  5. 05How HTTP status codes affect Google's crawlersdevelopers.google.com · checked 2026-10-25
Questions

Asked a lot.

4 questions people ask next, answered from the sources on this page.

01How do I increase the timeout for a Lambda function?

Open the function in the console, go to Configuration > General configuration > Edit, set Timeout up to 900 seconds and save. Or run aws lambda update-function-configuration --function-name my-function --timeout 120.

02How much time can Lambda run?

Up to 900 seconds (15 minutes) in a single invocation. AWS gives 5,400 seconds (90 minutes) for Lambda Managed Instances with asynchronous or event source mapping invocations, except Amazon MQ and Amazon DocumentDB.

03How many times does Lambda retry?

For asynchronous invocations that return an error, such as a timeout, Lambda runs the function two more times, waiting one minute and then two minutes. Throttling and system errors are retried for up to 6 hours by default.

04What is the default Lambda timeout?

3 seconds.

Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane