Not being able to upload a module through layers in lambda

0

I firstly created a folder and then installed 'pytz' module in the folder using cmd. Then I zipped the folder and created a layer and added that layer to my lambda function but still it shows the error of- 'No module named pytz'.

asked a year ago316 views
2 Answers
0

Hi. Did you concerned about layer paths for python Lambda runtime?Function code can access the layer content without the need to specify the path by defining the same folder structure.

#example
pillow.zip
│ python/PIL
└ python/Pillow-5.3.0.dist-info

https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html

profile picture
EXPERT
answered a year ago
0

Is my understanding correct that it is created with the same operation as this document?
https://docs.aws.amazon.com/lambda/latest/dg/python-package.html

In this case, you may succeed by changing the environment of the OS you created to Amazon Linux or Amazon Linux2.
https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html

You build your layer code into a .zip file archive using the same procedure that you would use for a function deployment package. If your layer includes any native code libraries, you must compile and build these libraries using a Linux development machine so that the binaries are compatible with Amazon Linux.

When you create a layer, you can specify whether the layer is compatible with one or both of the instruction set architectures. You may need to set specific compile flags to build a layer that is compatible with the arm64 architecture.

One way to ensure that you package libraries correctly for Lambda is to use AWS Cloud9. For more information, see Using Lambda layers to simplify your development process on the AWS Compute Blog.

profile picture
EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions