Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Lambda Error: Unzipped size must be smaller than 262144000 bytes

I am developing one lambda function, which use the ResumeParser library made in the python 2.7. But when I deploy this function including the library on the AWS it's throwing me following error:

Unzipped size must be smaller than 262144000 bytes

like image 701
vijaya Avatar asked Jul 27 '17 06:07

vijaya


People also ask

What is the maximum package size that can be uploaded to Lambda?

128 MB to 10,240 MB, in 1-MB increments.

How do I increase Lambda disk space?

Setting Larger Ephemeral Storage for Your Lambda Function To configure your Lambda function with larger ephemeral storage, choose the Configuration tab under the General Configuration section in the AWS Lambda Console. You will see a new configuration for Ephemeral storage setting at 512MB by default.

What are AWS lambda layers?

Lambda layers provide a convenient way to package libraries and other dependencies that you can use with your Lambda functions. Using layers reduces the size of uploaded deployment archives and makes it faster to deploy your code. A layer is a . zip file archive that can contain additional code or data.


2 Answers

Perhaps you did not exclude development packages which made your file to grow that big.

I my case, (for NodeJS) I had missing the following in my serverless.yml:

package:   exclude:     - node_modules/**     - venv/** 

See if there are similar for Python or your case.

like image 136
Greg Wozniak Avatar answered Nov 09 '22 14:11

Greg Wozniak


This is a hard limit which cannot be changed:

AWS Lambda Limit Errors

Functions that exceed any of the limits listed in the previous limits tables will fail with an exceeded limits exception. These limits are fixed and cannot be changed at this time. For example, if you receive the exception CodeStorageExceededException or an error message similar to "Code storage limit exceeded" from AWS Lambda, you need to reduce the size of your code storage.

You need to reduce the size of your package. If you have large binaries place them in s3 and download on bootstrap. Likewise for dependencies, you can pip install or easy_install them from an s3 location which will be faster than pulling from pip repos.

like image 29
Raf Avatar answered Nov 09 '22 13:11

Raf