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'.

已提問 1 年前檢視次數 342 次
2 個答案
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
專家
已回答 1 年前
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
專家
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南