InvalidParameterValueException
aws
config_error
ai_generated
true
An error occurred (InvalidParameterValueException) when calling the UpdateFunctionCode operation: Unzipped size must be smaller than 262144000 bytes
ID: aws/lambda-unzipped-size-exceeded-error
85%Fix Rate
90%Confidence
1Evidence
2023-03-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Lambda API 2015-03-31 | active | — | — | — |
| AWS CLI 2.15.0 | active | — | — | — |
Root Cause
The Lambda function deployment package exceeds the 250 MB unzipped size limit (262,144,000 bytes), often due to large dependencies or bundled layers.
generic中文
Lambda 函数部署包超过 250 MB 的解压大小限制(262,144,000 字节),通常是由于大型依赖项或捆绑的层。
Official Documentation
https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.htmlWorkarounds
-
90% success Move large dependencies to Lambda layers. Create a layer with the heavy libraries and attach it to the function. Example: `aws lambda publish-layer-version --layer-name my-layer --zip-file fileb://layer.zip` then `aws lambda update-function-configuration --function-name my-function --layers arn:aws:lambda:us-east-1:123456789012:layer:my-layer:1`
Move large dependencies to Lambda layers. Create a layer with the heavy libraries and attach it to the function. Example: `aws lambda publish-layer-version --layer-name my-layer --zip-file fileb://layer.zip` then `aws lambda update-function-configuration --function-name my-function --layers arn:aws:lambda:us-east-1:123456789012:layer:my-layer:1`
-
80% success Use AWS Lambda with container images (up to 10 GB) instead of zip deployment. Build a Docker image with the function code and dependencies, push to ECR, and update the function to use the image.
Use AWS Lambda with container images (up to 10 GB) instead of zip deployment. Build a Docker image with the function code and dependencies, push to ECR, and update the function to use the image.
中文步骤
Move large dependencies to Lambda layers. Create a layer with the heavy libraries and attach it to the function. Example: `aws lambda publish-layer-version --layer-name my-layer --zip-file fileb://layer.zip` then `aws lambda update-function-configuration --function-name my-function --layers arn:aws:lambda:us-east-1:123456789012:layer:my-layer:1`
Use AWS Lambda with container images (up to 10 GB) instead of zip deployment. Build a Docker image with the function code and dependencies, push to ECR, and update the function to use the image.
Dead Ends
Common approaches that don't work:
-
Compressing the deployment package with a higher compression ratio (e.g., zip -9) to reduce the zip file size.
95% fail
The limit is on unzipped size, not the zip file size; compression does not reduce unzipped content.
-
Removing unnecessary files from the deployment package but keeping large dependencies intact.
70% fail
The bulk of the unzipped size often comes from dependencies; cosmetic cleanup may not reduce size enough.