CloudConsole

Unzipped size must be smaller than 262144000 bytes

Updated 16 November 2026 · How we write and check guides

Short answer

The function's code plus all its layers would take more than 250 MB (262,144,000 bytes) once unzipped, which is the hard limit for zip-based functions. Layers don't get around it because they count toward the same total. Trim the package (remove bundled SDKs, tests and build artefacts), or switch to a container image, which can be up to 10 GB.

On this page, in 4 steps: 1. What the error means; 2. Measure what's taking the space; 3. Ways to shrink it; 4. When to…
The diagnosis and fix steps from this page, in the order to try them; commands and details are below.

What the error means

An error occurred (InvalidParameterValueException) when calling the UpdateFunctionCode operation:
Unzipped size must be smaller than 262144000 bytes

Lambda checks the extracted size of the deployment package and every attached layer together. Your zip can be well under 50 MB and still fail, since compression ratios for Python and Node.js dependencies are often five to ten times. Data science libraries are the usual culprits: numpy, pandas, scipy, pyarrow and machine learning frameworks are each tens to hundreds of megabytes.

Measure what's taking the space

mkdir /tmp/pkg && unzip -q function.zip -d /tmp/pkg
du -sh /tmp/pkg
du -sh /tmp/pkg/* | sort -h | tail -15

Don't forget layers. List them and their sizes for the function:

aws lambda get-function-configuration --function-name my-function \
  --query 'Layers[].[Arn,CodeSize]' --output table

CodeSize there is the zipped size; download and extract a layer the same way to see its real footprint.

Ways to shrink it

ChangeTypical saving
Don't bundle boto3/botocore (Python) or the AWS SDK v3 (Node.js) unless you need a specific version; the runtime includes themTens of MB
Node.js: bundle with esbuild instead of shipping node_modules; at minimum npm ci --omit=devOften most of the package
Remove tests, docs, type stubs and __pycache__ directories from installed packages10–30%
Strip debug symbols from compiled .so files (strip)Large for scientific packages
Replace heavy libraries with lighter ones (for example pandas only for one CSV read)Hundreds of MB

A cleanup pass for a Python package directory before zipping:

find package -type d \( -name '__pycache__' -o -name 'tests' \) -prune -exec rm -rf {} +
find package -name '*.so' -exec strip --strip-unneeded {} + 2>/dev/null
rm -rf package/boto3 package/botocore

Run your tests against the slimmed package; removing a directory a library needs at runtime turns this error into ImportModuleError.

When to move to a container image

If the dependencies are legitimately large, such as ML models or full scientific stacks, a container image is the supported route: images can be up to 10 GB and use the same Lambda features. Build for the function's architecture, push to ECR and deploy with update-function-code --image-uri; see InvalidEntrypoint for the common build pitfalls. Large model files can also be loaded at start-up from EFS, or downloaded to /tmp (configurable up to 10 GB of ephemeral storage), although that adds to cold-start time.

Whichever route you take, add a size check to the build so the pipeline fails with a clear message before it reaches Lambda, for example by comparing the output of du -sb on the extracted package against the limit.

Questions

What is the Lambda deployment package size limit?

250 MB unzipped for code plus all layers, and 50 MB zipped for direct uploads. Container images can be up to 10 GB.

Do Lambda layers increase the size limit?

No. Layers are counted together with the function code against the same 250 MB unzipped limit.

How do I include large Python libraries in Lambda?

Slim them where you can, then switch to a container image if they still don't fit. EFS is an option for very large data files or models.

CloudConsole Lambda function screen on a phone, for following up on Unzipped size must be smaller than 262144000 bytes away…
When this happens away from your desk

Package size errors block a deploy rather than break live traffic. CloudConsole, a phone app for AWS, is built to show function alarms on your phone so you can confirm the running version is still healthy while the build is fixed.

Did it start after a deploy? What changed? on the app’s alarm screen lists the deploys and configuration changes from the hour before the alarm fired.

About the app → · Download on the App Store

Sources