BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News AWS Lambda Doubles Its Timeout to 30 Minutes After Eight Years at 15

AWS Lambda Doubles Its Timeout to 30 Minutes After Eight Years at 15

Listen to this article -  0:00

AWS recently doubled the maximum timeout of on-demand Lambda Event Functions from 15 to 30 minutes. The new limit applies to synchronous, asynchronous, and event source mapping invocations in all commercial regions, at standard pricing and without an opt-in. The 15-minute ceiling had stood since 2018, after 60 seconds at launch in 2014 and five minutes from 2015.

Raising the limit is a configuration change per function, and Lambda rejects any value above 1,800 seconds with a validation error:

aws lambda update-function-configuration \
    --function-name my-demo-function \
    --timeout 1800

The change covers one of the three shapes Lambda took this year. Web Functions keep 15 minutes, and Lambda MicroVMs allow eight hours, while on Lambda Managed Instances synchronous invocations now get 30 minutes and asynchronous ones keep the 90 minutes introduced in September. AWS names agentic AI requests that chain model and tool calls, media transcoding, Monte Carlo simulations, and report generation as the workloads that outgrew 15 minutes.

According to Tarun Rai Madan, Dan Slusariuc, and Snehil Ameta, the authors of the announcement, the first thing to check before raising the timeout is capacity:

Concurrency equals requests per second multiplied by average duration in seconds. At the same request rate, a function that runs for 30 minutes instead of 15 needs twice the concurrency. For example, 1 request per second at 30 minutes each needs 1,800 concurrent executions.

The rest of the post is about what sits around the function. An SQS queue's visibility timeout has to be at least six times the function timeout, which means three hours. Kinesis and DynamoDB Streams read one batch per shard at a time, so a slow function slows the shard. Amazon MQ, DocumentDB and Kafka mappings created before November 19 stay at 14 minutes. A NAT gateway still drops idle connections after 350 seconds, and the Init phase keeps its 10-second limit.

Wibo van der Sluis, an independent AWS practitioner, tested the SQS rule in eu-west-1 by raising a function to 1,800 seconds behind a queue with a 90-minute visibility timeout and then lowering the queue to 60 seconds. Both changes were accepted with the mapping still enabled, while a new mapping from the same queue was refused:

So the check exists, but only at creation. One more thing the test showed: at creation, Lambda compared the queue with the function timeout itself, not with six times it. I did not test where exactly that line sits, so treat the six times as guidance you enforce yourself.

He adds that an asynchronous function which times out three times has run for 90 minutes before the event reaches a dead-letter queue, and concludes that 30 minutes is the wrong fix for slow code behind an API.

Luc van Donkersgoed, principal engineer at NS and AWS Serverless Hero, writes:

Hell froze over. AWS Lambda now supports 30-minute timeouts. I am not sure how I feel about this.

The comments under the post took two directions. Magnus Eriksson, architect and former AWS employee, notes that Lambda "is anyhow quite expensive per CPU second compared to EC2" and would still reserve it for short-lived spiky loads. Matthew Bonig, AWS DevTools Hero and co-author of The CDK Book, looked further ahead: "Eventually it'll be 8 hours, and then nobody will be able to understand when to use it vs. MicroVMs."

On Reddit, the most-upvoted reply welcomed the change because it avoids Fargate and ECS for hour-long batch jobs. The answer under it was that Fargate is beautifully simple. One commenter sets out where the longer limit fits:

A 30 minute run still bills for the full duration at your configured memory, so check the cost per invocation before moving batch style work here, and keep the handler idempotent with a dead letter queue, because a failure or timeout partway through a long run can leave partial work behind. For multi step work, long running jobs, or anything that needs clear state and retries, Step Functions with Fargate or ECS is still usually cleaner.

Joseph Emison, CTO of Branch Insurance, reads the move as Lambda team recognizing that Cloud Run is its most compelling competitor. Cloud Run services allow 60 minutes per request, and Azure Functions on the Flex Consumption and Premium plans enforce no maximum, with a 60-minute grace period during scale-in. AWS has not said whether the Lambda limit will move again.

About the Author

Rate this Article

Adoption
Style

BT