Currently I’m trying to use the matplotlib
library in my source code so I want to create a layer. However it is not working now. I don’t know if I’m configuring it wrong, so when I invoke the lambda function, so when I invoke the lambda function the layer doesn’t work?
And also I work on Windows
Below are the commands I use to create layers and lambda functions:
-
pip install -r requirements.txt -t layer
→ To intall lib and zip it to matplotlib.zip -
aws --endpoint-url http://localhost:4566 lambda publish-layer-version --layer-name matplotliblayer \ --license-info "MIT" \ --zip-file fileb://layer/matplotlib.zip \ --compatible-runtimes python3.9 \ --compatible-architectures "arm64" "x86_64"
-
aws --endpoint-url=http://localhost:4566 lambda create-function \ --function-name lane-fuction\ --runtime python3.9 \ --role arn:aws:iam::000000000000:role/lambda-role \ --handler route/lane.main \ --zip-file fileb://src/route.zip) \ --timeout 120 \ --layers arn:aws:lambda:ap-northeast-1:000000000000:layer:matplotliblayer:1
The structure of the matplotlib.zip file is as follows:
matplotlib.zip
___└── python
_______└── dependencies
I also tried the structure as shown in the AWS docs
If anyone has successfully installed the layer, please help me. Thank you everyone