04 / 10

What is the default timeout for a Lambda function?

The default timeout for an AWS Lambda function is 3 seconds. This means that if the function does not complete execution within 3 seconds, it will be automatically terminated by AWS. You can increase the timeout based on your workload, up to a maximum of 15 minutes (900 seconds).

Key Notes on Lambda Timeouts
  1. 1

    Default timeout: 3 seconds

  2. 2

    Maximum timeout: 15 minutes (900 seconds)

  3. 3

    Timeout can be configured during function creation or updated later

  4. 4

    Longer timeouts consume more billed duration and should be used with caution

  5. 5

    Timeout settings apply per invocation

Setting Timeout via AWS CLI
Difficulty: 4/10
Topics: AWS Lambda configuration, Timeout limits, Serverless orchestration

Scenario Questions

0-2 years experience
  1. 1

    You've deployed a new Lambda function that calls a third-party payment gateway. It works fine in your local tests, but in production, it occasionally fails with a 'Task timed out' error after exactly 3 seconds. What is likely happening here, and how would you fix it?

  2. 2

    Imagine you have a Lambda function that processes image uploads. If a user uploads a large file and the processing takes 10 seconds, what will happen if you deployed the Lambda with its out-of-the-box default settings? Where would you go to change this?

2-5 years experience
  1. 1

    We have a Lambda function triggered by an API Gateway endpoint. Users are occasionally getting 504 Gateway Timeout errors, but when you check the Lambda logs, the function actually finishes successfully after 45 seconds. How do these two timeouts interact, and how would you resolve this mismatch?

  2. 2

    You are debugging a system where a Lambda processes messages from an SQS queue. You notice in the logs that some messages are being processed three or four times, even though the Lambda eventually completes successfully. How does the Lambda timeout configuration relate to SQS visibility timeouts, and how would you fix this duplication?

5-8 years experience
  1. 1

    We are designing a data ingestion pipeline where a Lambda function processes large CSV files from S3. As the business grows, some files are taking longer than 15 minutes to process, causing the Lambda to hard-fail. How would you re-architect this ingestion process to handle arbitrarily large files without running into Lambda's execution limits?

  2. 2

    Your team wants to set a very generous timeout—say, 10 minutes—on all synchronous Lambda functions 'just in case' downstream databases are slow. What are the architectural, cost, and blast-radius implications of doing this under high-traffic conditions?

8+ years experience
  1. 1

    Our enterprise is migrating a legacy batch-processing system to AWS. Some of these legacy jobs run for hours. How would you design the decision framework and architectural guardrails to help engineering teams choose between Lambda, Step Functions, and ECS/Fargate based on execution limits and cost-efficiency?

  2. 2

    We have a complex, distributed serverless application with hundreds of microservices. During a recent downstream database brownout, we experienced a cascading failure because upstream Lambdas kept retrying and holding connections open. How would you design a standardized timeout, retry, and circuit-breaker strategy at the platform level to prevent this?

Follow-up Questions

  • If a Lambda function times out while processing an SQS queue message, what happens to that message?
  • How does setting an excessively high timeout impact your concurrency limits and AWS bill during a downstream outage?
  • How does the 29-second API Gateway integration timeout change how you design long-running synchronous APIs?