Which AWS Lambda Timeout Applies - On-Demand, Managed Instances, and the Callers That Stop Waiting First

First Published:
Last Updated:

As of November 19, 2026, the timeout for AWS Lambda Event Functions is now a maximum of 1,800 seconds (30 minutes) for on-demand execution. For Lambda Managed Instances (LMI), the timeout is a maximum of 5,400 seconds (90 minutes) for asynchronous invocations and for invocations from event source mappings (ESM) excluding those using Amazon MQ and Amazon DocumentDB. However, even with a timeout set to 30 minutes, the caller may not wait the full 30 minutes. API Gateway stops waiting for a response after 29 or 30 seconds. AWS CLI, by default, will stop reading after 60 seconds and may resend the same request. According to the blog, synchronous invocations on LMI will terminate after 30 minutes, even if the configured timeout value is higher.

This article categorizes the values that actually end a single invocation or the caller's wait for it into five categories: the function's upper limit, the initialization limit, the time callers wait, ESM constraints, and timeouts counted differently. It then puts in one table which of these values applies first on each invocation path. A demo also shows that the function keeps running after a caller stops waiting, and that SDK and CLI retries can run the same input again.

This article is based on documentation read on December 4, 2026. This was the final day of re:Invent 2026 (November 30 to December 4, 2026), and the Lambda, API Gateway, and Step Functions pages may change after the event. This article does not cover pricing, the internals of the execution environment, or the design of durable functions.

Related articles on this site:

Table of Contents

  1. 1. Scope and Assumptions
  2. 2. Limits on the Function Side
  3. 3. Initialization Limits and the Formula Where 900 Seconds Remains
  4. 4. Callers That Stop Waiting First
  5. 5. After the Caller Stops Waiting
  6. 6. ESM Constraints
  7. 7. Timeouts Counted Differently
  8. 8. Demo: Who Stops Waiting First
  9. 9. What to Check Before Raising the Timeout
  10. 10. Frequently Asked Questions About Lambda Timeouts
  11. 11. Summary
  12. 12. References

1. Scope and Assumptions

This chapter first defines the intended audience, the scope of this article, the referenced materials, the notation used, and the terminology. The following eight points represent the key conclusions:

  • The timeout for on-demand Event Functions is a maximum of 1,800 seconds. Values of 1,801 seconds or more are rejected with a validation error. A new value takes effect for invocations that start after the update (see Chapter 2).
  • In LMI, asynchronous and ESM (excluding Amazon MQ and Amazon DocumentDB) invocations have a maximum timeout of 5,400 seconds, while synchronous invocations have a maximum timeout of 30 minutes. According to the blog, synchronous invocations are cut off at 30 minutes even if the configured value is higher (see Chapter 2).
  • The Init limit is counted separately from the function timeout. For on-demand functions, it is 10 seconds. For provisioned concurrency, SnapStart, and LMI, the limit is a maximum of 15 minutes, with the higher value between 130 seconds and the function timeout serving as the upper limit. However, only up to 900 seconds of the function timeout counts. The value 900 remains in this formula (see Chapter 3).
  • A synchronous caller may stop waiting before the function timeout is reached. For API Gateway REST APIs, the default timeout is 29 seconds; for HTTP APIs, it is 30 seconds; and for Amazon Cognito triggers, it is 5 seconds. The Lambda developer guide states that function URLs and Step Functions wait for the function to return (see Chapter 4).
  • Even if the caller stops waiting, the function keeps running until it returns or reaches its timeout, and that time is billed. The AWS CLI and AWS SDK automatically retry on client timeouts, so the same input may run again one or more times (see Chapter 5).
  • In LMI, even if a function reaches its timeout, Lambda does not forcibly terminate the code. This is a different point from the caller stopping waiting first (see Chapter 5).
  • According to the SQS page, an SQS ESM validates, when the ESM is created or updated, that the function timeout is less than or equal to the queue's visibility timeout. It does not check this when the function timeout is changed. The limit for Amazon MQ and Amazon DocumentDB ESMs differs by page: 14 minutes or 15 minutes (see Chapter 6).
  • The durable execution timeout, the request timeout for Web Functions, and the execution time for MicroVMs are all separate values from the function timeout (see Chapter 7).

1.1 Intended Readers

We are targeting individuals who are attempting to run processes exceeding 15 minutes within Lambda, those experiencing API call timeouts at 29 or 60 seconds despite increasing the timeout to 30 minutes, and those seeking to understand what factors to consider before increasing timeout settings in services like SQS or Kafka's ESM. We assume a basic understanding of Lambda's execution environment (the Init and Invoke phases) and the differences between synchronous and asynchronous invocations.

1.2 What This Article Covers and What It Does Not

This article covers where the values that end a single invocation or the caller's wait for it sit, and which of them applies first on each path.

The following topics are left to existing articles on this site:


Pricing, GB-second rates, and cost estimates are not covered in this article.

1.3 Checked Date and Materials Read

Verification date: 2026-12-04. The following materials were reviewed:

  • AWS Lambda Developer Guide (configuration of timeouts, quotas, execution environment lifecycle, invocation from other services, synchronous and asynchronous invocation, retries, SQS, Kinesis, DynamoDB Streams, Amazon MQ, Amazon DocumentDB, Kafka ESM, LMI best practices and execution environment, durable functions, function URLs, Web Functions, response streaming, document history)
  • AWS Lambda API Reference (CreateFunction, UpdateFunctionConfiguration)
  • API Gateway Developer Guide (quotas for REST APIs and HTTP APIs, response streaming)
  • AWS Step Functions Developer Guide, Amazon Cognito Developer Guide, and ELB ALB User Guide
  • AWS CLI User Guide and Command Reference, boto3 and botocore documentation
  • AWS What's New (announcements dated 2026-11-19, 2026-11-25, and 2026-09-09)
  • AWS Compute Blog announcement: "Announcing 30-minute timeout for on-demand AWS Lambda Event Functions" (2026-11-19)

The What's New announcement was released on 2026-11-19T19:00:00Z. As of 2026-12-04, the Lambda Developer Guide's document history does not mention the 30-minute timeout (Not stated). This article uses dates from the What's New announcements and the Compute Blog.

What's New and the blog say that the 30-minute timeout is available for on-demand Event Functions in all commercial AWS Regions, and for synchronous invocations on LMI in all Regions where LMI is available (Stated).

1.4 Statement Labels

This article puts one of the following five labels on each statement:

LabelMeaning
StatedDocumented in the Lambda Developer Guide, API Reference, other service developer guides, or the "What's New" section. The specific document is noted in the text.
BlogDocumented solely in a post on the AWS Compute Blog (published November 19, 2026) and not found in the Developer Guide.
Not statedNot found within the pages reviewed for this article. This does not constitute proof of non-existence.
InferenceReasoned by this article from what the pages say.
MeasuredRecorded during the demonstration in Chapter 8 using this specific configuration. Results may vary with different configurations or on different dates.

The Not stated label is applied only to items that could not be found even after trying different search terms. Do not read Not stated as meaning "not possible" or "unavailable."

1.5 How Terms Are Used

The term "timeout" refers to at least five different values. This article names the one it means each time.

  • Function Timeout: The Timeout setting for a function. This is the maximum number of seconds a single function invocation can run.
  • Initialization Limit: The maximum time the Init phase can run. This is tracked separately from the function timeout.
  • Caller Wait Time: The time the calling component waits for a response. This includes timeouts for API Gateway integrations, SDK and CLI read operations, among others.
  • Durable Execution Timeout: The total time allowed for the execution of a durable function. This is referred to as ExecutionTimeout.
  • Web Functions Request Timeout: The time allowed for a single HTTP request to Web Functions. This is specified as timeoutSeconds.

In addition, the following terms are used:

  • Event Functions: A term used in the AWS Lambda developer guide to refer to functions that process events. It is used alongside Web Functions and MicroVMs. In this article, the term "function" refers to Event Functions unless otherwise specified.
  • On-Demand: Execution on the default capacity, without LMI.
  • Asynchronous Invocation: An invocation with InvocationType set to Event. This is a different term from the "Event" associated with Event Functions.
  • Retry: The action of a caller resending the same request. Lambda's asynchronous retries, ESM retries, and SDK and CLI retries are all separate mechanisms.

2. Limits on the Function Side

This chapter checks, against the pages, the values you can set for the function timeout and when a value takes effect.

2.1 On Demand: 1,800 Seconds

The Lambda developer guide's timeout page describes the function timeout as follows (Stated):

Timeout is the maximum amount of time in seconds that a Lambda function can run. The default value for this setting is 3 seconds, but you can adjust this in increments of 1 second up to a maximum value of 1,800 seconds (30 minutes).

The default is 3 seconds, and it can be increased in 1-second increments up to 1,800 seconds. The "Function timeout" row on the Quotas page also indicates 1,800 seconds (Stated).

This limit applies to all function invocations – synchronous, asynchronous, and ESM – with the exception of those covered in Section 2.4 regarding ESM. The Compute Blog states that on-demand Event Functions can now have a maximum duration of up to 30 minutes for synchronous, asynchronous, and ESM invocations (Blog). What's New gives the same scope (Stated).

According to the blog, the evolution of this limit has been as follows: 60 seconds in 2014, 5 minutes in 2015, 15 minutes in 2018, and 30 minutes as of 2026-11-19 (Blog). We defer to the published AWS History and Timeline regarding AWS Lambda for a comprehensive historical record.

2.2 LMI: 5,400 Seconds for Asynchronous and ESM, 30 Minutes for Synchronous

On LMI, the limit depends on the invocation type. The timeout page says (Stated):

For functions using AWS Lambda Managed Instances, asynchronous invocations and event source mapping invocations (except Amazon MQ and Amazon DocumentDB) support a maximum allowed value of 5,400 seconds (90 minutes).

Synchronous invocations are limited to 30 minutes. The LMI best practices page says (Stated):

Synchronous invocations are limited to 30 minutes, and the function initialization phase remains limited to 15 minutes.

A "What's New" update from September 9, 2026, said, when it announced the 90 minutes for LMI, that synchronous invocations stayed at 15 minutes (Stated).

Synchronous invocations retain the existing 15-minute maximum timeout.

The November 19, 2026 announcement replaced this statement. The November 19, 2026 What's New says that synchronous invocations on LMI also support up to 30 minutes (Stated).

2.3 According to the Blog, LMI Synchronous Invocations Stop at 30 Minutes Even If the Setting Is Higher

An LMI function can be set to as much as 5,400 seconds for asynchronous and ESM invocations. What happens when the same function is invoked synchronously? According to the Compute Blog (Blog):

On Lambda Managed Instances, Lambda applies the 30-minute limit to synchronous invocations even if the function timeout is higher, and the GetFunctionConfiguration API reports the configured value.

Specifically, if an LMI function configured with a value of 5,400 seconds is invoked synchronously, it is cut off at 30 minutes. In that case, GetFunctionConfiguration returns the configured value of 5,400 seconds, not 30 minutes. Reading the configuration does not tell you when a synchronous invocation is cut off.

The LMI best practices page states that synchronous invocations are limited to 30 minutes. However, the developer guide pages this article read do not say that Lambda cuts the invocation shorter than the configured value, or that GetFunctionConfiguration returns the configured value (Not stated).

2.4 Amazon MQ, Amazon DocumentDB, and Older Kafka ESMs

When an ESM invokes the function, some event sources lower the limit.

The limit for Amazon MQ and Amazon DocumentDB ESMs differs between pages: 14 minutes on some, 15 minutes on others.

  • The Amazon MQ page, the Amazon DocumentDB page, and the Compute Blog say 14 minutes (Stated, Blog).
  • The LMI best practices page and the ESM page for durable functions say 15 minutes (Stated).

The Amazon MQ page says (Stated):

While Lambda Event Functions typically have a maximum timeout limit of 30 minutes, event source mappings for Amazon DocumentDB and Amazon MQ for ActiveMQ and RabbitMQ only support functions with maximum timeout limits of 14 minutes.

The LMI best practices page says (Stated):

Functions on AWS Lambda Managed Instances can run for up to 90 minutes (5,400 seconds) per invocation for asynchronous invocations and for event source mapping invocations, except Amazon MQ and Amazon DocumentDB event source mappings, which remain limited to 15 minutes.

This article does not determine which value is correct. It simply documents the fact that the two pages list different values. The blog recommends keeping function timeouts to 14 minutes (840 seconds) or less for these ESMs (Blog). Staying at 14 minutes keeps the function under the limit on either page (Inference).

Kafka ESMs also have a limit that depends on when they were created. The Compute Blog says (Blog):

The same limit applies to Kafka event source mappings that were created before November 19, 2026, and don’t use provisioned mode. To use the 30-minute timeout with Kafka, create a new event source mapping or turn on provisioned mode for your existing one.

Kafka ESMs created before 2026-11-19 and not using provisioned mode remain limited to 14 minutes. This limitation is not found on the Kafka page in the Lambda developer guide (for self-managed Apache Kafka and Amazon MSK) (Not stated).

2.5 1,801 Seconds Is a Validation Error

Values above the limit are rejected when you set them. The Compute Blog says (Blog):

Lambda rejects higher values with a validation error.

The API reference documentation for CreateFunction and UpdateFunctionConfiguration specifies a maximum value of 1,800 seconds for the Timeout parameter (Stated). However, the Valid Range of the same field says only "Minimum value of 1." and gives no upper limit (Stated). The upper limit is described in the explanation text, but not in the Valid Range section.

In the demonstration in Chapter 8, we recorded the error message that appeared when a value of 1,801 seconds was set (Measured, Section 8.2).

2.6 When the New Value Takes Effect

Raising the timeout does not affect invocations that are already running. The Compute Blog says (Blog):

The new timeout applies to invocations that start after you update the function. For event source mappings, allow a few minutes for the change to propagate.

A new value applies to invocations that start after the update. For ESMs, the change takes a few minutes to propagate.

3. Initialization Limits and the Formula Where 900 Seconds Remains

This chapter covers the limits on the initialization phase separately from the function timeout. The internal workings of the initialization phase are left to the existing article How AWS Lambda Execution Environments Work.

3.1 On-Demand Init: 10 Seconds

The lifecycle page for the execution environment states the limit on the Init phase as follows (Stated):

The Init phase is limited to 10 seconds. If all three tasks do not complete within 10 seconds, Lambda retries the Init phase at the time of the first function invocation with the configured function timeout.

For on-demand functions, the Init time is limited to 10 seconds. If Init does not finish within 10 seconds, Lambda retries the Init phase at the time of the first invocation, with the function timeout as the limit. Even if the function's timeout is increased, the 10-second limit for Init remains unchanged. The Compute Blog also states that the Init phase keeps its existing limits after the 30-minute change (Blog).

In the demonstration in Chapter 8, a function that takes 12 seconds for initialization was called, and this retry of Init was recorded (Measured, Section 8.6).

3.2 Provisioned Concurrency, SnapStart, and LMI: Up to 15 Minutes

A note on the same page describes where the 10 seconds does not apply (Stated):

For provisioned concurrency, SnapStart, and Managed Instances functions, your initialization code can run for up to 15 minutes. The time limit is 130 seconds or the configured function timeout (maximum 900 seconds, even if the function timeout is longer), whichever is higher.

Init for provisioned concurrency, SnapStart, and LMI functions can run for up to 15 minutes. The limit is the greater of 130 seconds and the function timeout. However, only up to 900 seconds of the function timeout counts. The LMI execution environment page gives the same formula (Stated).

3.3 900 Seconds Is Still There

Even with the function timeout at 1,800 seconds, the value 900 has not disappeared from the pages. As of December 4, 2026, the value "900" was found in three places in the materials reviewed for this article:

  • In the Init formula in Section 3.2. Even with a function timeout of 1,800 seconds, the Init limit stays at 900 seconds (Stated, Inference).
  • In the Web Functions request timeout, which ranges from 3 to 900 seconds (Stated, Section 7.2).
  • In the documentation of an older, pinned SDK version. For example, the description of Lambda APIs in botocore version 1.44.6 states that the function timeout limit is 900 seconds. This value was changed to 1,800 seconds in version 1.44.7, released on November 19, 2026 (Stated, botocore change history and model definitions). If you read the SDK documentation in an environment pinned to an older version, you see 900.

Therefore, it is inaccurate to state that "900 seconds no longer appears anywhere" or that "the SDK documentation still states 900 seconds." You need to tell which 900 you are reading.

4. Callers That Stop Waiting First

This chapter lists how long synchronous callers wait for a response. Even with the function timeout at 30 minutes, if the caller stops waiting first, the invocation fails from the caller's point of view.

4.1 Table in the Lambda Developer Guide

The "Response timeouts for synchronous callers" section of the Lambda Developer Guide begins as follows (Stated):

An Event Function can run for up to 30 minutes. When a service invokes your function synchronously, the service might stop waiting for the response before your function finishes. Your function keeps running until it returns or reaches its timeout, and you're charged for that duration.

The table on this page lists five callers (Stated).

CallerWait Time (as described on the page)
Amazon API Gateway REST APIs29 seconds by default (integration timeout)
Amazon API Gateway HTTP APIs30 seconds (maximum integration timeout)
Amazon Cognito user pool triggers5 seconds
AWS Step FunctionsUntil the function returns
Lambda function URLsUntil the function returns

The timeout page also states that when other services make synchronous calls, those services may stop waiting before the function's timeout is reached (Stated).

4.2 Table 1: Which Value Applies First on Each Path

This table adds what other pages say to the table in Section 4.1. The "Value That Applies First" column assumes on-demand functions with a timeout of 1,800 seconds (Inference).

PathCaller Wait TimeCan Be Changed?Value That Applies FirstLabel
API Gateway REST API (Regional, private)Integration timeout. Default: 29 secondsCan be raised above 29 seconds. The page gives no value for how far.Integration timeoutStated
API Gateway REST API (edge-optimized)Integration timeout. 50 milliseconds to 29 secondsCannot be raised.29 secondsStated
API Gateway REST API Response StreamingMaximum 15 minutes. Idle timeout is 5 minutes for Regional and private, and 30 seconds for edge-optimized.Not specified on the page.15 minutesStated
API Gateway HTTP APIIntegration timeout. Maximum 30 secondsCannot be raised.30 secondsStated
Amazon Cognito User Pool Triggers5 secondsCannot be changed.5 secondsStated
Lambda Function URLUntil the function returns—Function timeoutStated
ALB TargetUntil the function responds or times out—Function timeoutStated
Step Functions Standard WorkflowUntil the function returns (Lambda page). Default timeout exists for Request Response tasks (Step Functions page – value not specified on the page).TimeoutSecondsSection 4.5Stated, Not stated
Step Functions Express WorkflowMaximum 5 minutes for the entire executionCannot be raised.5 minutesStated
AWS CLI (aws lambda invoke)Read timeout. Default: 60 seconds--cli-read-timeout (0 waits without a limit)60 seconds, followed by retriesStated, Measured
AWS SDK for Python (boto3)read_timeout. Default: 60 secondsConfig's read_timeout60 seconds, followed by retriesStated, Measured

Figure 1 illustrates this table as the path from the caller to the function.

4.3 Figure 1: Which Limit Applies First on Each Lambda Invocation Path

Which Limit Applies First on Each Lambda Invocation Path
Which Limit Applies First on Each Lambda Invocation Path
The left side of Figure 1 shows the caller and its wait time. The right side shows the limits on the function side, with the Init limit in front of the function timeout. If the caller's wait time is shorter than the function timeout, the caller's value applies first (Inference).

4.4 API Gateway's 29 and 30 Seconds

The REST API Quotas page marks the integration timeout "Yes *" (adjustable) for Regional and private endpoints and "No" for edge-optimized endpoints (Stated). The footnote reads (Stated):

You can raise the integration timeout to greater than 29 seconds, but this might require a reduction in your Region-level throttle quota for your account.

You can raise it above 29 seconds, but your account's Region-level throttle quota may have to be reduced. How far it can be raised is not given on this page (Not stated).

The HTTP API Quotas page states that the "Maximum integration timeout" is 30 seconds, and that it is not adjustable (Stated).

The REST API Response Streaming page states that using streaming allows you to exceed the 29-second limit without increasing the integration timeout, and that you can stream for up to 15 minutes (Stated). Choosing an API Gateway type is left to the existing Amazon API Gateway Decision Guide.

4.5 How Each Step Functions Page Describes It

The way Step Functions is described varies depending on the page.

  • The table in the Lambda developer guide says "Until the function returns" (Stated)
  • The page on integrating Step Functions with Lambda states that when a Lambda function is invoked, the execution waits for the function to complete (Stated)
  • The page on Step Functions integration patterns states that if TimeoutSeconds is not configured for a Request Response task, a default timeout will apply. It also states that there is an upper limit to the time Step Functions will wait for a service API's response, and that a larger TimeoutSeconds does not extend that limit (Stated). Neither value is given on the page (Not stated)
  • Express workflows have a maximum execution time of 5 minutes (Stated, Step Functions quotas page)

What's New and the Compute Blog state that the 30-minute timeout also applies when you invoke functions from Step Functions Standard workflows (Stated). When an invocation from Step Functions runs longer than 15 minutes, check the workflow type and the task's TimeoutSeconds (Inference).

4.6 Cognito and ALB

The Amazon Cognito developer guide states that, with the exception of custom sender triggers, Cognito calls trigger functions synchronously. It further states that these functions must respond within 5 seconds, and that this 5 seconds cannot be changed (Stated).

When Amazon Cognito calls your Lambda function, it must respond within 5 seconds. If it doesn't and if the call can be retried, Amazon Cognito may retry the call. If all retry attempts fail, the function times out. You can't change this five-second timeout value.

Because Cognito may retry, trigger functions can also receive the same input more than once (Inference).

The ALB user guide states that when a Lambda function is a target, the load balancer waits until the function responds or times out (Stated).

The load balancer waits until your Lambda function responds or times out.

4.7 Read Timeouts in the AWS CLI and SDK

Both the CLI and SDK have a default timeout for socket reads.

The AWS CLI user guide describes --cli-read-timeout as follows (Stated):

Specifies the maximum socket read time in seconds. If the value is set to zero (0) the socket read waits indefinitely (is blocking) and doesn't timeout. The default value is 60 seconds.

The botocore Config documentation also gives 60 seconds as the default for read_timeout (Stated). The default values for SDKs in other languages vary depending on the language and version. This article focuses solely on the AWS CLI and boto3.

The Lambda developer guide, in its section on synchronous invocations, recommends that when calling long-running functions synchronously, developers should set the client's read timeout to be longer than the function's timeout and turn on TCP keep-alive (Stated). In the CLI, --cli-read-timeout 0 waits without a time limit (Stated).

5. After the Caller Stops Waiting

This chapter describes what happens on the function's side after the caller stops waiting.

5.1 The Function Keeps Running, and Billing Continues

As stated in Section 4.1, even if the caller stops waiting, the function will continue to run until it returns a result or reaches a timeout, and that time is billed (Stated). What ended was the caller's connection, not the function invocation.

The API Gateway response streaming page says that the function might continue to execute (Stated).

When the connection between the client and API Gateway or between API Gateway and Lambda is closed due to timeout, the Lambda function might continue to execute.

The page on Lambda response streaming states that a streamed response does not stop when the client connection is broken (Stated).

Streaming responses incur cost and streamed responses are not interrupted or stopped when the invoking client connection is broken. Customers are billed for the full function duration, so customers should exercise caution when configuring long function timeouts.

Setting the function's timeout to 30 minutes means that even if the caller terminates a request after 29 seconds, the function can run for up to 30 minutes (Inference). The demo in Chapter 8 recorded the function running to the end after API Gateway stopped waiting (Measured, Section 8.4).

5.2 SDK and CLI Retries Can Run the Same Input Again

The synchronous invocation page says (Stated):

The AWS CLI and AWS SDK also automatically retry on client timeouts, throttling, and service errors.

When the SDK or CLI stops waiting due to a read timeout, it may resend the same request. As described in Section 5.1, the first invocation keeps running on the function's side. So invocations with the same input can run at the same time (Inference).

The number of retry attempts is determined by the retry configuration. The AWS CLI user guide states that the default mode for AWS CLI version 2 is "standard," with a total of three attempts (Stated). The boto3 documentation also states that the default mode is "standard," with a total of three attempts, including the initial request (Stated). However, the "standard" mode's list of retryable errors does not explicitly include ReadTimeoutError; instead, it lists errors such as ConnectionError and HTTPClientError (Stated). The documentation does not specify how many retry attempts occur in the case of a read timeout (Not stated).

In the demonstration in Chapter 8, the AWS CLI and boto3, using their default configurations, were used to make a 90-second call, and the number of times an invocation with the same input started on the function side was counted (Measured, Section 8.5).

Designing the function to be idempotent is needed on every path (Inference).

5.3 LMI Does Not Stop the Code After a Timeout

So far, even when the caller stops waiting first, the function still stops at its own timeout. LMI has one more difference. The LMI execution environment page says (Stated):

However, Lambda Managed Instances does not forcibly terminate your code—it continues running in the execution environment. As a function developer, you are responsible for detecting and handling the timeout.

In LMI, when an invocation reaches its timeout, Lambda returns a timeout error to the caller. However, the code does not stop. The same page says the code keeps occupying a runtime worker while it runs, and that side effects can still happen after the timeout (Stated). The page recommends checking the remaining time with the context object and stopping before the timeout (Stated).

On demand, the invocation stops at the function timeout. The execution environment lifecycle page says the function timeout setting limits the duration of the entire Invoke phase (Stated). Designing LMI timeout handling goes beyond the existing AWS Lambda Managed Instances article, so this article only shows what the pages say.

6. ESM Constraints

This chapter briefly outlines the constraints to be checked before increasing the timeout of a function invoked by an ESM. The handling of failed batches is left to the existing article What Happens to a Failed Batch in a Lambda Event Source Mapping.

6.1 SQS Validates at Creation and Update, Not When the Function Timeout Changes

The SQS event source mapping configuration page says (Stated):

Your function's timeout must be less than or equal to the queue's visibility timeout. Lambda validates this requirement when you create or update an event source mapping and returns an error if the function timeout exceeds the queue's visibility timeout. Lambda doesn't check this requirement when you change the function timeout.

Validation only confirms that the function timeout is less than or equal to the visibility timeout. This validation occurs during ESM creation and updates, but is not performed when the function timeout is modified. The same page explains that if the function timeout is set longer than the visibility timeout, messages may reappear in the queue, and the same message may be processed more than once (Stated). The page recommends increasing the queue's visibility timeout before increasing the function timeout. The timeout page recommends the same order (Stated).

The same page recommends setting the visibility timeout to be at least six times the function timeout (Stated). While six times is a recommendation, it is not a validation requirement. The Compute Blog and the LMI best practices page, right after recommending six times, say "Lambda validates this when you create the event source mapping" (Blog, Stated). Do not read this as six times being validated. As for when, those two pages mention creation only, while the SQS page says creation and update.

In the demonstration described in Chapter 8, creation was rejected. However, changes to the function timeout, and updates that only modified the batch size of the disabled ESM, both proceeded without error (Measured, Section 8.7).

6.2 Kinesis and DynamoDB Streams: One Batch per Shard

Kinesis documentation states that functions process one batch at a time from each shard (Stated). The Compute Blog describes how longer invocations slow shard reads (Blog).

For Amazon Kinesis Data Streams and Amazon DynamoDB Streams, Lambda processes one batch per shard at a time by default, so longer invocations slow how quickly each shard is read. Monitor the IteratorAge metric and increase the parallelization factor if records start to back up.

If you raise the function timeout and a single invocation gets longer, shard reads can fall behind and IteratorAge can grow.

6.3 Amazon MQ, Amazon DocumentDB, and Older Kafka

As mentioned in Section 2.4, the ESM limits for Amazon MQ and Amazon DocumentDB are 14 or 15 minutes, depending on the page. According to the blog, Kafka ESMs created before November 19, 2026 that do not use provisioned mode are limited to 14 minutes (Blog).

7. Timeouts Counted Differently

This chapter covers three values that are counted separately from the function timeout.

7.1 The Durable Execution Timeout

The durable functions basic concepts page says (Stated):

The execution timeout controls how long a durable execution can run from start to completion. This is different from the Lambda function timeout, which controls how long a single function invocation can run.

The function timeout limits one invocation, while the execution timeout (ExecutionTimeout) limits the whole execution. The execution timeout can be up to one year (Stated).

However, depending on the invocation path, the overall execution may also be subject to the same upper limit as the function's timeout.

  • When invoked from ESM, the overall duration of a durable function execution cannot exceed 30 minutes for on-demand executions and a maximum of 90 minutes when using LMI, except for Amazon MQ and Amazon DocumentDB ESMs, which remain at 15 minutes (Stated, ESM page for durable functions).
  • Durable functions accessed via a function URL must have an execution timeout of 1,800 seconds or less (Stated, function URL page).
  • A table on the Compute Blog indicates the following limits for durable functions: 30 minutes for on-demand synchronous executions, 1 year for asynchronous executions, and 30 minutes when using ESM. For LMI, the limits are 30 minutes for synchronous executions, 1 year for asynchronous executions, and 90 minutes when using ESM (Blog).

The design details are delegated to Section 5.1 of the existing AWS Lambda Durable Functions Practical Guide. The extension for handling Lambda MicroVMs from durable functions was announced as a developer preview on 2026-11-25 (Stated).

7.2 The Web Functions Request Timeout

The Web Functions configuration page describes the request timeout as follows (Stated):

The timeoutSeconds setting controls the maximum time that a single HTTP request can run before Lambda terminates it. Valid values are 3–900 seconds (15 minutes). The default is 30 seconds.

The maximum time allowed for a single request to a Web Function is a separate value from the timeout for Event Functions. The default is 30 seconds, with a maximum of 900 seconds. If a non-streaming request exceeds this time, Lambda will return an HTTP 504 error, along with a lambda-web-error-type header with the value Runtime.RequestTimeout (Stated). The Compute Blog table also gives 15 minutes for Web Functions (Blog). For more on Web Functions, see the published AWS Lambda Web Functions as a Contract.

7.3 Eight Hours for MicroVMs

The Lambda quota page states that the maximum runtime for a single MicroVM is 8 hours (28,800 seconds) (Stated). The Compute Blog table describes these 8 hours as running and suspended time combined (Blog).

8. Demo: Who Stops Waiting First

This chapter invokes the same Lambda function from several paths and sets what each caller saw beside what the function did. The results are what this setup recorded on this day (Measured). This data is not intended for performance comparisons.

8.1 Setup

We created a single CloudFormation stack in the us-east-1 region.

  • One Lambda function (Python 3.14, 128 MB memory, 1,200 second timeout). It sleeps for the number of seconds specified in the input seconds, and logs the input identifier run_id and RequestId at the start and end of execution. Asynchronous retries are set to 0.
  • One Lambda function that sleeps for 12 seconds in its initialization code (30 second timeout).
  • One HTTP API, one REST API (Regional), and one Function URL. All are authorized using IAM, and the integration timeout is left at the default setting.
  • One SQS queue (visibility timeout of 60 seconds).

Each invocation carried its own run_id in the input. Counting how many times the same run_id started in the function's logs shows how many times the same input ran.

This demo does not use provisioned concurrency or LMI. So the LMI limits and the 15-minute Init limit were not checked here.

8.2 Rejecting 1,801 Seconds

Setting the function timeout to 1,801 seconds in the AWS CLI resulted in a rejection due to a validation error (Measured).

An error occurred (ValidationException) when calling the UpdateFunctionConfiguration operation: Value '1801' at 'timeout' failed to satisfy constraint: Member must have value less than or equal to 1800

1,800 seconds was accepted, and get-function-configuration returned 1800 (Measured). The API reference's Valid Range gives no upper limit, but the service validated 1,800 as the upper limit.

8.3 Asynchronous and Synchronous Invocations Beyond 900 Seconds

A 960-second sleep, exceeding the previous limit of 900 seconds, was run once as an asynchronous invocation and once through a function URL.

PathObserved by CallerFunction's REPORT Duration
Invoke (InvocationType is Event)0.7 seconds, status 202960,002.49 ms
Function URL (BUFFERED, IAM authorization)960.8 seconds, status 200960,002.67 ms

In both invocations, the function ran the full 960 seconds (Measured). The caller of the function URL, as recommended in Section 4.7, set the read timeout to 1,150 seconds, which is longer than the function's sleep duration, and enabled TCP keep-alive.

8.4 Results by Caller

From synchronous callers, a 45-second or 90-second sleep was run once each.

PathSleepWhat the Caller SawCaller's Elapsed TimeFunction's REPORT DurationStarts of the Same Input
API Gateway HTTP API45 secondsHTTP 503 (Service Unavailable)30.6 seconds45,002.63 ms1
API Gateway REST API (Regional)45 secondsHTTP 504 (Endpoint request timed out)29.6 seconds45,002.85 ms1
AWS CLI (default settings)90 secondsRead timeout on endpoint URL error (exit code 255)181.6 seconds90,014.31 ms, 90,002.29 ms, 90,015.80 ms3
boto3 (default settings)90 secondsReadTimeoutError181.3 seconds90,002.18 ms, 90,002.97 ms, 90,002.64 ms3
boto3 (read_timeout 120 seconds, total_max_attempts 1)90 seconds20090.6 seconds90,002.40 ms1
AWS CLI (--cli-read-timeout 0)90 seconds20090.9 seconds90,002.51 ms1

API Gateway stopped waiting after approximately 30 seconds. The HTTP API returned a 503, and the REST API returned a 504. The function continued to execute the 45-second sleep for its entirety (Measured). This setup confirmed what Section 5.1 says: the function keeps running after the caller stops waiting. This article did not check the 503 from the HTTP API against the documentation.

8.5 Figure 2: What Each Caller Saw and What the Function Did

What Each Caller Saw and What the Function Did
What Each Caller Saw and What the Function Did
Figure 2 sets out the eight invocations from Sections 8.3 and 8.4, split into what the caller saw and what the function did.

With default settings, the AWS CLI and boto3 both hit the 60-second read timeout and resent the same request. On the function side, the same run_id started three times. The intervals between these starts were approximately 60 seconds, with the next invocation starting before the previous one finished (Measured). The caller only received the final error, with a total elapsed time of approximately 181 seconds. On the function's side, three 90-second invocations ran (Measured).

As Section 5.2 notes, the standard retry list does not name ReadTimeoutError. Even so, in this demo, the clients made three attempts in total, with read timeouts in between (Measured). This matches the default in Section 5.2: three attempts, including the first.

If the read timeout is set longer than the function's sleep time, or if the --cli-read-timeout 0 option is used, the function starts only once, and the caller receives a 200 status code (Measured).

8.6 The 10-Second Init Limit

A function that sleeps for 12 seconds in its initialization code was invoked synchronously in a new execution environment. The function's logs are as follows (Measured; RequestIds are omitted).

02:33:55.753Z {"mark": "INIT_CODE_START"}
02:34:05.650Z INIT_REPORT Init Duration: 10000.26 ms Phase: init Status: timeout
02:34:05.740Z {"mark": "INIT_CODE_START"}
02:34:17.740Z {"mark": "INIT_CODE_END"}
02:34:17.742Z START RequestId: … Version: $LATEST
02:34:17.759Z REPORT RequestId: … Duration: 12098.95 ms Billed Duration: 12099 ms Memory Size: 128 MB Max Memory Used: 34 MB

Init was cut off at 10 seconds, and INIT_REPORT indicated Status: timeout. Immediately after, the initialization code started again, completing after 12 seconds, and then the handler was executed. The invocation succeeded, and the caller received a 200 status code after 26.5 seconds (Measured).

The Init Duration field was not present in the REPORT lines, and the Duration was 12,098.95 ms. The roughly 12 seconds of the re-run Init are included in the invocation's Duration (Measured). This matches Section 3.1: at the first invocation, Lambda re-runs Init with the function timeout as the limit. This demonstration does not test scenarios where the re-execution exceeds the function's 30-second timeout.

8.7 Validating the SQS Visibility Timeout

When attempting to create an ESM with a function timeout of 1,200 seconds on a queue with a visibility timeout of 60 seconds, the creation was rejected (Measured).

An error occurred (InvalidParameterValueException) when calling the CreateEventSourceMapping operation: Queue visibility timeout: 60 seconds is less than Function timeout: 1200 seconds

Increasing the queue's visibility timeout to 1,300 seconds allowed the ESM to be created. The ESM was created disabled, and no messages were sent. Subsequently, the function timeout was increased to 1,500 seconds, which is longer than the visibility timeout. This change did not result in an error (Measured). This matches Section 6.1: Lambda does not check this when the function timeout changes.

Following a 30-second wait, with the function timeout still set at 1,500 seconds and the visibility timeout at 1,300 seconds, an update was made to change the ESM's batch size to 5. This update also completed without error, and the ESM's batch size was successfully changed to 5 (Measured).

The SQS page states that Lambda also validates when the ESM is updated (Section 6.1). In this demonstration, the update only changed the batch size of a disabled ESM. It is not possible to determine from this single test which updates trigger validation, or whether validation runs on a disabled ESM (Inference). This does not contradict the Compute Blog and the LMI best practices page, which say that Lambda validates at creation but does not prevent later changes. Therefore, when changing the function timeout or visibility timeout after the ESM has been created, it is necessary to manually verify the relationship between the two values, rather than relying on validation (Inference).

9. What to Check Before Raising the Timeout

This chapter summarizes what to check before increasing the timeout for a function.

Verification ItemReasonChapter
Is the waiting time of the caller longer than the new function timeout?API Gateway, Cognito, CLI, and SDK will stop waiting first.Chapter 4
Client read timeout and retry settingsClients stop waiting at the default 60 seconds and may resend the same input.Section 4.7, Section 5.2
Does the function stay correct when it receives the same input more than once?A retry can overlap the first invocation, which keeps running.Section 5.2
On LMI, does the code check the remaining time and stop?LMI does not stop the code after the timeout.Section 5.3
Did you raise the SQS visibility timeout first?It is not checked when the function timeout changes.Section 6.1
Is it an Amazon MQ, Amazon DocumentDB, or older Kafka ESM?These have a 14- or 15-minute limit.Section 2.4
For Kinesis and DynamoDB Streams, consider the IteratorAge.Long calls can slow down shard reads.Section 6.2
The durable execution timeout and the invocation pathSynchronous, ESM, and function URLs all have overall execution time limits.Section 7.1
Concurrent execution quota.Even with the same request frequency, longer calls increase concurrent execution.Paragraph below the table
Consider the idle timeout for downstream connections.NAT gateways will terminate idle connections after 350 seconds.Paragraph below the table

The last two rows are based on a Compute Blog post. The blog states that concurrency is the product of the number of requests per second and the average execution time. Therefore, if the execution time doubles while maintaining the same request frequency, the required concurrency also doubles (Blog). On downstream connections, the blog says (Blog):

If your function routes traffic through a NAT gateway, which drops idle connections after 350 seconds, send keep-alive packets.

10. Frequently Asked Questions About Lambda Timeouts

Q1. If I set the function timeout to 1,800 seconds, will API Gateway wait up to 30 minutes for the API call?

No. API Gateway's REST APIs default to a 29-second timeout, while HTTP APIs have a maximum timeout of 30 seconds. API Gateway will stop waiting after that time. While the timeout for Regional and private REST APIs can be increased, the maximum allowable value is not specified in the documentation. HTTP APIs and edge-optimized REST APIs cannot be raised.

Q2. If API Gateway stops waiting after 29 seconds, does the function also stop?

No. The function will continue to run until it returns a result or reaches its timeout, and you will be charged for that time. The Lambda developer guide says so.

Q3. If I set an LMI function to 5,400 seconds, will synchronous invocations also run for up to 90 minutes?

No. The limit for synchronous invocations on LMI is 30 minutes. According to the blog, even if the configured value exceeds 30 minutes, synchronous invocations are cut off at 30 minutes, and GetFunctionConfiguration will return the configured value.

Q4. Is the value of 900 seconds no longer used?

It is still used. The formula for provisioned concurrency, SnapStart, and LMI Init only counts the function timeout up to 900 seconds. The request timeout range for Web Functions is also between 3 and 900 seconds.

Q5. What happens if I use the AWS CLI to synchronously call a long-running function?

By default, the CLI will stop reading after 60 seconds and may retry the request. Because the first invocation keeps running on the function's side, the same input may be processed multiple times. When waiting for a long-running function, use --cli-read-timeout 0 and, as described in Section 4.7, enable TCP keep-alive. Also, refer to the results of the demonstration in Chapter 8.

Q6. If I raise the timeout of a function with an SQS ESM, do I get an error?

No, you will not encounter errors when you change the function's timeout. According to the SQS documentation, Lambda validates this condition only during ESM creation and updates, and does not inspect it when you change the function's timeout. In the demonstration in Chapter 8, updating only the batch size of the disabled ESM also did not result in an error. Increase the queue visibility timeout first.

Q7. Is the limit for an Amazon MQ ESM 14 minutes or 15 minutes?

It depends on the page. For the Amazon MQ and Amazon DocumentDB pages, and the Compute Blog, it is stated as 14 minutes. For the LMI best practices and durable functions ESM pages, it's stated as 15 minutes. The blog recommends setting function timeouts to 840 seconds or less for these ESMs.

Q8. If I increase the timeout value, will it affect currently running invocations?

No, it will not. According to the blog, the new value only applies to invocations that start after the update. For ESMs, the change takes a few minutes to propagate.

11. Summary

  • The timeout for on-demand Event Functions is a maximum of 1,800 seconds, effective from 2026-11-19. Values of 1,801 seconds or more cause a validation error, and a new value applies to invocations that start after the update. The API reference's Valid Range says only "Minimum value of 1."
  • For LMI, the maximum timeout is 5,400 seconds for asynchronous and ESM operations (except Amazon MQ and Amazon DocumentDB), and 30 minutes for synchronous operations. According to the blog, synchronous invocations are cut off at 30 minutes even if the configured value is higher, and GetFunctionConfiguration returns the configured value.
  • The limit for Amazon MQ and Amazon DocumentDB ESMs differs by page: 14 minutes and 15 minutes. Kafka ESMs created before 2026-11-19 that do not use provisioned mode are limited to 14 minutes, according to the blog.
  • On-demand Init is limited to 10 seconds. If it runs over, Lambda retries Init at the first invocation, with the function timeout as the limit. For provisioned concurrency, SnapStart, and LMI, Init can run up to 15 minutes, and 900 seconds remains in the formula for that limit.
  • Synchronous callers may stop waiting first. REST APIs wait 29 seconds by default, HTTP APIs 30 seconds, and Cognito 5 seconds, and the default timeout for CLI and boto3 read operations is 60 seconds. Function URLs and Application Load Balancers (ALB) wait until the function returns. For Step Functions, the Lambda developer guide says it waits until the function returns, but a default task timeout and a limit on the wait for the API response also apply (Section 4.5).
  • Even if the caller stops waiting, the function continues to execute, and billing continues accordingly. The CLI and SDK retry on client timeouts, so the same input can run again.
  • LMI does not forcibly terminate the code even after the function timeout.
  • An SQS ESM validates at creation and update that the function timeout is less than or equal to the visibility timeout, and does not check it when the function timeout changes, according to the SQS page. In the demonstration, creation was rejected, but updates that only modified the batch size of the disabled ESM were successful. Six times is a recommendation.
  • The timeout for durable executions, the request timeout for Web Functions, and the 8-hour limit for MicroVMs are separate values from the function timeout.
  • This article is based on documentation reviewed on 2026-12-04, the final day of re:Invent 2026. The information on the pages may change.

12. References



References:
Tech Blog with curated related content

Written by Hidekazu Konishi