0

I am trying to deploy my function on AWS Lambda. I need the following packages for my code to function:

  • keras-tensorflow
  • Pillow
  • scipy
  • numpy
  • pandas

I tried installing using docker and uploading the zip file, but it exceeds the file size.

Is there a get around for this? How to use these packages for my Lambda function?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470

2 Answers2

4

publish your packages in AWS Lambda layer instead, and reference it from your code. The packages published in the AWS Lambda layer will be there all the time and will not need to instantiate whenever the Lambda cold start.

There is complete documentation from official AWS Websites: Here

xion
  • 1,209
  • 11
  • 17
  • I think this is a more official way of solving the issue rather than uploading to s3 in the accepted answer – jet_choong Nov 26 '19 at 03:54
  • I have posted a new question. Could you please help in using vgg 16 model on aws lambda. I am running out of space when I load the model on lambda – Jerry George Nov 26 '19 at 15:32
1

when the zip file size is bigger than 49 mb, You can upload the zip file to Amazon S3 and use it to update the function code.

aws lambda update-function-code --function-name calculateMath --region us-east-1 --s3-bucket calculate-math-bucket --s3-key 100MBFile.zip

BMW
  • 42,880
  • 12
  • 99
  • 116
Arun Kamalanathan
  • 8,107
  • 4
  • 23
  • 39