How to add python libraries to lambda using the CDK?
0
I want to use a library in my lambda function that was created by the CDK.
I did the following, without success:
-
add the library to my requirements.txt file
Pillow
-
import the library in my lambda function
from PIL import Image
-
install it and deploy
source .env/bin/activate pip install -r requirements.txt cdk deploy`
Many thanks for any hints!
- Topics
- ServerlessCompute
- Tags
- AWS Lambda
- Language
- English
asked 6 years ago8.1K views
1 Answer
- Newest
- Most votes
- Most comments
0
Accepted Answer
You should have a look at the aws-lambda-python module: https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-python-readme.html
It's still experimental and needs docker, but it will take care of your requirements.txt.
The same exists for nodejs just in case (https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-nodejs-readme.html).
answered 6 years ago
Relevant content
- Accepted Answer
asked 3 years ago
