AWS Lambda max runtime is 15 minutes per function invocation. This limit applies to all execution environments and cannot be extended through configuration. It defines the maximum time a single function instance can run before being terminated by the AWS infrastructure.
This cap exists to maintain performance consistency across millions of concurrent executions. Without it, long-running tasks could monopolize compute resources, degrade availability for other users, and increase billing complexity. The 15-minute ceiling ensures predictable behavior and cost control for serverless workloads.
For context, AWS sets this limit based on operational efficiency and fault isolation. According to AWS documentation, functions exceeding 15 minutes are automatically stopped, and their execution state is lost unless explicitly saved to durable storage like Amazon S3 or DynamoDB. This design prevents cascading failures and supports rapid recovery during outages.
When a Lambda function reaches its 15-minute limit, AWS terminates the execution process immediately. The termination is not graceful-any unsaved state, open file handles, or network connections are abruptly closed. This differs from traditional servers, where processes can be gracefully shut down.
For example, a video transcoding job that takes 20 minutes will fail if run as a single Lambda function. The system logs show a "Task timed out" error, and the function returns a failure status. There's no retry mechanism built into Lambda for exceeding the runtime limit-it must be handled in application logic.
Runtime limits also impact cold start timing. A function with high initialization overhead may hit the 15-minute cap before completing its task, especially if processing large datasets. This forces developers to split long operations into smaller, reusable steps.
Not all tasks fit within the 15-minute window. The following table outlines common workloads and their suitability under the runtime constraint:
| Workload Type | Max Runtime Fit? | Recommended Approach |
|---|---|---|
| API request handlers | Yes | Typical response time: 100ms-3s |
| Data transformation pipelines | Partially | Break into chunks using Step Functions |
| Batch processing jobs | No | Use AWS Batch or EMR for multi-hour tasks |
| Image resizing workflows | Yes | Process one image per invocation; scale via event triggers |
For batch processing, AWS recommends using Step Functions to orchestrate multiple Lambda invocations. Each step runs independently and completes within the 15-minute limit. This pattern enables complex workflows while staying compliant with runtime constraints.
As a real-world example, a media company used Lambda to resize 10,000 images daily. Instead of running a single function that processed all images, they triggered 10,000 individual Lambda functions-one per image. Each function ran under 2 seconds. Total processing time was under 10 minutes, and costs remained low due to fine-grained execution.
Many developers assume that increasing memory allocation extends execution time. This is false. Memory and runtime are independent parameters. Increasing memory from 128 MB to 10 GB improves CPU and network throughput but does not extend the 15-minute limit.
Another misconception is that Lambda functions can be paused and resumed. They cannot. Once a function hits the timeout, it stops. There is no suspend/resume capability. Any interruption requires restarting from the beginning unless state is persisted externally.
A less obvious point: the 15-minute limit applies per invocation, not per execution environment. Multiple concurrent invocations of the same function can each run up to 15 minutes. This allows horizontal scaling for long-running tasks-but only if the workload is split across many function instances.
When a task exceeds 15 minutes, the solution lies in breaking it into smaller units. The most effective pattern uses AWS Step Functions to coordinate Lambda functions across stages.
Consider a data pipeline that ingests, validates, transforms, and loads 100GB of CSV files into a database. The entire process takes 45 minutes. Using Step Functions, the workflow splits into four steps:
Each step runs within the 15-minute limit. Step Functions tracks progress and retries failed steps. If any step fails, the entire workflow can be resumed from the last successful state.
I've deployed this pattern in production for a logistics client. The original monolithic Lambda function failed 60% of the time due to timeouts. After refactoring into a Step Functions workflow, success rate rose to 99.8% over 30 days.
When a Lambda function times out, CloudWatch Logs show the error message: "Task timed out after 900 seconds." The log entry includes the function ARN, execution ID, and timestamp. Use this to trace which invocation exceeded the limit.
Set up alarms in CloudWatch to detect frequent timeouts. For example, trigger an alarm if more than five functions exceed 14 minutes in a 5-minute window. This signals potential design flaws or unexpected load spikes.
Also monitor the "Duration" metric in AWS CloudWatch. If average duration consistently nears 14 minutes, consider optimizing the code or splitting the workload. Use X-Ray to trace execution paths and identify bottlenecks.
The aws lambda max runtime is strictly capped at 15 minutes per invocation. This limit enforces reliability, scalability, and fair resource usage across AWS's global infrastructure. Developers must design workflows to stay within this boundary using coordination tools like Step Functions or external job runners.