AWS Lambda Limits: Timeout, Payload Size and Quotas

AWS Lambda limits from the official docs: 15-minute timeout, 6 MB sync and 1 MB async payloads, memory, package size, concurrency and workarounds.

Aug 8, 2025 - 14:22
Nov 11, 2026 - 19:19
 0  104
AWS Lambda Limits: Timeout, Payload Size and Quotas

An AWS Lambda function can run for at most 900 seconds (15 minutes) per invocation. Synchronous invocations accept up to 6 MB for the request and 6 MB for the response, streamed responses can reach 200 MB, and asynchronous invocations accept 1 MB. None of these values can be raised, so you design around them.

This guide lists the Lambda quotas that matter most in day-to-day work, explains which ones are hard limits and which you can raise, and shows the design patterns teams use when a workload outgrows them. Every number below comes from the official Lambda quotas page and related AWS documentation. If Lambda is new to you, read what AWS Lambda is and how serverless architecture works first, and the wider AWS vs Azure vs GCP tool comparison for context.

Key takeaways

  • Maximum function timeout is 900 seconds (15 minutes). The default when you create a function is much lower, so check it.
  • Synchronous payloads: 6 MB request and 6 MB response. Streamed responses: up to 200 MB. Asynchronous payloads: 1 MB.
  • Deployment packages: 50 MB zipped for direct upload, 250 MB unzipped including layers, and 10 GB for container images.
  • Memory runs from 128 MB to 10,240 MB, and CPU scales with memory. At 1,769 MB a function gets the equivalent of one vCPU.
  • Default concurrency is 1,000 per Region, and it can be increased. Timeout and payload limits cannot.
  • API Gateway REST APIs have their own 29-second default integration timeout, which often bites before the Lambda timeout does.
  • Large data goes through Amazon S3. Long jobs go to Step Functions, durable functions, or containers on ECS/Fargate.

Lambda limits at a glance

The table covers the quotas that most often shape an architecture. AWS uses MB to mean 1,024 KB throughout its Lambda documentation.

ResourceQuotaCan you raise it?
Function timeout900 seconds (15 minutes)No
Synchronous invocation payload6 MB request, 6 MB responseNo
Streamed response (synchronous)200 MBNo
Asynchronous invocation payload1 MBNo
Request line and headers combined1 MBNo
Memory128 MB to 10,240 MB, 1 MB stepsNo (fixed range)
/tmp ephemeral storage512 MB to 10,240 MB, 1 MB stepsNo (fixed range)
Environment variables4 KB total per functionNo
Layers5 per functionNo
Deployment package (.zip)50 MB zipped (API, SDK or console upload); 250 MB unzipped incl. layersNo (upload larger zips through S3, still 250 MB unzipped)
Container image10 GB uncompressed, all layersNo
Concurrent executions1,000 per RegionYes, to tens of thousands
Concurrency scaling rate1,000 execution environments every 10 seconds per functionNo
Code storage (.zip and layers, Lambda-managed)300 GB per RegionNo (use self-managed S3 code storage)
File descriptors / processes and threads1,024 eachNo
Function resource-based policy20 KBNo

Two notes on that table. New accounts start with reduced concurrency and memory quotas that AWS raises automatically as you use the service, so a fresh account may show a lower number than 1,000 in the Service Quotas console. And Lambda Managed Instances functions follow some different rules (for example a 90-minute maximum for asynchronous and most event source mapping invocations), which are outside the scope of this article.

The timeout limit in detail

What happens when a function times out

The timeout setting is the maximum time Lambda lets one invocation run. When it is reached, Lambda stops the invocation and reports a timeout error. Your code gets no chance to finish its current step, so any work that was half done (a partial file upload, an uncommitted database transaction) stays half done. Design handlers so that a retry can safely repeat the work.

The ceiling is 900 seconds. The value you set can be anything from 1 second up to that ceiling. Pick a value close to the realistic worst case for the function plus a margin, not the maximum. A tight timeout stops a stuck call to a downstream service from burning 15 minutes of compute and holding a concurrency slot the whole time.

Setting the timeout

With the AWS CLI:

aws lambda update-function-configuration \
  --function-name orders-processor \
  --timeout 120

In an AWS SAM template:

Resources:
  OrdersProcessor:
    Type: AWS::Serverless::Function
    Properties:
      Handler: app.handler
      Runtime: python3.12
      Timeout: 120
      MemorySize: 1024

Check the supported runtimes list before picking a runtime version, since AWS deprecates older ones on a published schedule.

Timeouts set by the caller

The function timeout is only one of the clocks running. The service that invokes the function often has a shorter one:

  • API Gateway REST APIs have an integration timeout of 50 milliseconds to 29 seconds by default for all integration types, including Lambda. For Regional and private APIs you can request more than 29 seconds, though AWS notes this may require a lower Region-level throttle quota. Edge-optimized APIs cannot go above 29 seconds. See the API Gateway REST API quotas.
  • SDK clients have their own read timeouts. If the client gives up first, it may retry while the first invocation is still running, which doubles the work.
  • Event source mappings (SQS, Kinesis, DynamoDB Streams) have settings such as the SQS visibility timeout that must be longer than the function timeout, or messages reappear while still being processed. The SQS event source documentation covers the recommended values.

So an API backed by Lambda behind a REST API is effectively a 29-second function unless you change the API Gateway quota. If a request needs longer, move the slow part to an asynchronous flow and return a job ID.

The payload limits in detail

Synchronous: 6 MB each way

A synchronous invocation (the caller waits for the result, as with API Gateway, an Application Load Balancer, or aws lambda invoke with the default RequestResponse type) can send up to 6 MB of request data and receive up to 6 MB back. The limit covers the serialized payload. If your function returns binary data that a front end encodes as base64, the encoded form is larger than the raw bytes, so you hit the limit sooner than the file size suggests.

A request that goes through API Gateway first also has to fit API Gateway's own limit, which is 10 MB for REST APIs. The smaller of the two numbers wins, which in practice is Lambda's 6 MB.

Response streaming: up to 200 MB

Lambda response streaming lets a function send its response in chunks as it produces them. A streamed response can be up to 200 MB. Bandwidth is uncapped for the first 6 MB and then limited to 2 MBps for the rest, so a 200 MB response takes time. Streaming is useful for large reports, server-side rendering, and AI responses that should appear to the user as they are generated.

Asynchronous: 1 MB

Asynchronous invocations (S3 event notifications, SNS, EventBridge, or --invocation-type Event) accept up to 1 MB. AWS raised this from 256 KB, as described on the AWS Compute Blog. Lambda puts the event in an internal queue and returns HTTP 202 right away. If the function fails, Lambda by default retries twice more, waiting one minute before the second attempt and two minutes before the third, and keeps throttled events for up to 6 hours. Those settings are described in asynchronous error handling. Configure an on-failure destination or a dead-letter queue so failed events are not lost.

aws lambda invoke \
  --function-name orders-processor \
  --invocation-type Event \
  --cli-binary-format raw-in-base64-out \
  --payload '{"orderId": "A-1001"}' \
  response.json

Event sources have their own sizes

A function triggered by another service also inherits that service's message size limit. An SQS message, for example, has its own maximum size defined in the SQS quotas, and Lambda batches several messages into one event. When you size a batch, check both the source quota and Lambda's 6 MB synchronous limit for event source mappings. For queue behaviour, see integrating SQS with EC2 or Lambda.

Other quotas that shape design

Memory and CPU

Memory can be set from 128 MB to 10,240 MB in 1 MB steps. Lambda gives CPU in proportion to memory, and at 1,769 MB a function has the equivalent of one full vCPU. A CPU-bound function that times out at 512 MB may finish well inside the limit at 2,048 MB, and because you pay for duration multiplied by memory, the larger setting can cost the same or less. Measure it rather than guessing. The open source AWS Lambda Power Tuning tool runs a function at several memory sizes and charts cost against duration.

Ephemeral storage

Each execution environment has a /tmp directory configurable from 512 MB to 10,240 MB. It survives between invocations that reuse the same environment, which makes it useful for caching downloaded models or reference data, but you cannot rely on it being there. For shared, persistent files, Lambda can mount Amazon EFS.

Deployment package size

A .zip package can be 50 MB when uploaded directly. Larger zips can be uploaded through S3, but the unzipped contents, including all layers and any custom runtime, must stay under 250 MB. Heavy dependencies such as machine learning libraries often exceed that, and the usual answer is to package the function as a container image, which can be up to 10 GB uncompressed.

Concurrency

Concurrency is the number of invocations running at the same time. The default account limit is 1,000 per Region, shared by every function in that Region, and you can request more. Each function can add up to 1,000 execution environments every 10 seconds when traffic jumps. Reserved concurrency caps a single function (protecting a fragile database, for example), while provisioned concurrency keeps environments initialized to cut cold starts. For tuning cold starts, see optimizing Lambda cold start times.

AWS's own quotas page makes a useful point about mismatches: API Gateway has a default throttle of 10,000 requests per second, while Lambda's default concurrency is 1,000, so a busy API can send more traffic than Lambda will accept. Load test the full path before launch.

Design patterns for workloads that exceed the limits

ProblemPatternAWS services
Upload or download larger than 6 MBClient transfers the file directly to S3 using a presigned URL; Lambda only handles metadataS3, Lambda
Event larger than 1 MBClaim check: store the body in S3, send a pointer (bucket and key) in the eventS3, SQS/SNS/EventBridge
Large response to a browserResponse streaming, or write the result to S3 and return a linkLambda function URLs, S3
Job longer than 15 minutesSplit into steps orchestrated by a state machine, each step well under the timeoutStep Functions, Lambda durable functions
Batch of many independent itemsFan out: one function lists the items, others process them in parallelStep Functions Distributed Map, SQS
Long-running process that cannot be splitRun it as a container task instead of a functionECS on Fargate, AWS Batch
API call that needs more than 29 secondsAccept the request, return a job ID, process asynchronously, let the client poll or receive a callbackAPI Gateway, SQS, Lambda, DynamoDB

Presigned URLs for large files

The most common payload fix is to keep file bytes out of Lambda entirely. A small function generates a presigned S3 URL, the client uploads straight to S3, and an S3 event notification triggers processing afterwards. This removes the 6 MB limit, cuts Lambda duration, and works with S3 multipart upload for very large objects.

import boto3

s3 = boto3.client("s3")

def handler(event, context):
    key = f"uploads/{event['requestContext']['requestId']}.bin"
    url = s3.generate_presigned_url(
        "put_object",
        Params={"Bucket": "my-upload-bucket", "Key": key},
        ExpiresIn=900,
    )
    return {"statusCode": 200, "body": url}

For the processing side, see S3 event notifications with Lambda.

Step Functions for long work

When the total job takes longer than 15 minutes, break it into steps that each finish well under the timeout and let AWS Step Functions run them in order, with retries and error handling defined in the state machine. Lambda also offers durable functions, which checkpoint progress so a multi-step workflow written as code can continue across invocations. Each durable operation has its own quotas (for example 1 MB per checkpoint payload), so read the quota table before choosing it.

Checkpointing inside a function

For a loop over many records, read context.get_remaining_time_in_millis() (Python) and stop cleanly before the timeout, saving your position so the next invocation picks up from there:

def handler(event, context):
    start = event.get("cursor", 0)
    items = load_items()
    for i in range(start, len(items)):
        if context.get_remaining_time_in_millis() < 30_000:
            return {"done": False, "cursor": i}
        process(items[i])
    return {"done": True}

A Step Functions loop can call this function until done is true.

Monitoring how close you are to the limits

Lambda publishes metrics to CloudWatch that map directly to these quotas:

  • Duration: compare the maximum and p99 against the configured timeout. Alarm when p99 passes about 80 percent of it.
  • Errors and timeout messages in logs: a line like Task timed out after 120.00 seconds in CloudWatch Logs confirms a timeout.
  • Throttles and ConcurrentExecutions: show when you are hitting reserved or account concurrency.
  • AsyncEventAge and AsyncEventsDropped: show asynchronous events waiting too long or being discarded.

The full list is in Lambda metrics types. For log analysis, see monitoring and debugging Lambda with CloudWatch Logs.

aws cloudwatch put-metric-alarm \
  --alarm-name orders-processor-duration-p99 \
  --namespace AWS/Lambda \
  --metric-name Duration \
  --dimensions Name=FunctionName,Value=orders-processor \
  --extended-statistic p99 \
  --period 300 \
  --evaluation-periods 3 \
  --threshold 96000 \
  --comparison-operator GreaterThanThreshold

That alarm fires when p99 duration stays above 96 seconds (80 percent of a 120-second timeout) for 15 minutes.

Common errors and what they mean

ErrorLikely causeFix
Task timed out after N secondsSlow downstream call, too little memory/CPU, or work too large for one invocationAdd client timeouts, raise memory, split the job
RequestEntityTooLargeExceptionInvocation payload over the 6 MB or 1 MB limitPass an S3 reference instead of the data
Response too largeFunction returned more than 6 MB synchronouslyStream the response or return an S3 link
HTTP 504 from API Gateway while the function keeps runningAPI Gateway integration timeout (29 s default) reached firstMake the API asynchronous or request a higher integration timeout
TooManyRequestsException / throttlingConcurrency limit reachedRequest a quota increase, add reserved concurrency, or buffer with SQS
Unzipped size exceeds limit on deployPackage plus layers over 250 MBTrim dependencies or switch to a container image

Practise this hands-on

Lambda quotas show up in both AWS architecture design questions and real incident reviews. If you want structured practice with Lambda, API Gateway, Step Functions and CloudWatch, the AWS Solutions Architect Associate training covers the design side and the AWS DevOps Engineer Professional training covers automation and monitoring. Both run as classroom batches in Kharadi, Pune and as live online classes across India. For Lambda's best practices in general, see writing scalable Lambda functions.

Frequently asked questions

What is the maximum timeout for AWS Lambda?

900 seconds, which is 15 minutes, per invocation. You cannot raise it with a quota request. Work that takes longer must be split into steps (for example with Step Functions) or moved to a container service such as ECS on Fargate.

What is the Lambda payload size limit?

6 MB for the request and 6 MB for the response on synchronous invocations, 200 MB for a streamed response, and 1 MB for asynchronous invocations. The combined request line and headers are limited to 1 MB.

Can I increase the Lambda timeout or payload limits?

No. Both are fixed. Concurrency and ENIs per VPC are the main Lambda quotas you can raise through the Service Quotas console.

Why does API Gateway return 504 before my Lambda finishes?

REST API integrations time out after 29 seconds by default. The function keeps running, but the client has already received a 504. Make the endpoint asynchronous or request a higher integration timeout for a Regional or private API.

How do I send files larger than 6 MB through Lambda?

Do not send them through Lambda. Generate a presigned S3 URL, let the client upload to S3 directly, and trigger processing from an S3 event. Return large results the same way.

What is the maximum memory for a Lambda function?

10,240 MB, configurable in 1 MB steps from 128 MB. CPU is allocated in proportion to memory, with the equivalent of one vCPU at 1,769 MB.

How large can a Lambda deployment package be?

50 MB zipped for a direct upload, 250 MB unzipped including layers, or 10 GB for a container image.

What is the default Lambda concurrency limit?

1,000 concurrent executions per Region, shared across functions. New accounts can start lower and AWS raises the value automatically. You can request an increase.

Official references

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.