Loading large python packages into AWS lambda function
I cannot get around this error (below) when trying to load a function on AWS lambda:
Failed to save the Code tab. Reason: The indiscriminate size must be less than 262144000 bytes.
I pinned the function and all its dependencies and uploaded the zipped file to S3 and pasted the url of the S3 file into the lambda prompt (download the file from Amazon S3).
Any findings would be appreciated. Thanks to
source to share
Adding to Entropic's answer, how about using something like pyminifier ? This can be a very simple solution if minimizing it is enough to reach the 250MB limit.
Also, if you are using the AWS SDK, you do not need to include it in your package as it is included in the Lambda runtime . It can also save some space if that's the case.
source to share
As mentioned in the spit, there is a hard limit at 250MB. There were some good ideas in this reddish thread: https://www.reddit.com/r/aws/comments/4qrw9m/how_to_work_around_aws_lambdas_250mb_limit/
Most solutions are line by line 1) Loading more code later, thus breaking the 250 limit.2) Split the code into smaller pieces, which is more aws-lambda-ish anyway, and 3) use a strip command like this guy: https://serverlesscode.com/post/scikitlearn-with-amazon-linux-container/
2 is probably the best way if you can split it.
source to share