Steps adapted from how to create AWS Lambda Layer for Python.
Note: Ran all the below steps in an EC2 Linux server.
mk wordcloud_layer && cd wordcloud_layer
- Create
requirements.txt
:
wordcloud>=1.9.3
pillow>=9.5
- Pip install like this:
$ mkdir python
$ pip install \
--no-cache-dir \
--platform manylinux2014_x86_64 \
--target=python/ \
--implementation cp \
--python-version 3.11 \
--only-binary=:all: \
--upgrade \
-r requirements.txt
- Create a layer zip:
zip -r9 wordcloud-layer.zip .
- Upload zip to S3:
aws s3 cp wordcloud-layer.zip s3://bucket/path/to/folder/wordcloud-layer.zip
- Now create an AWS Lambda Layer from AWS Console using the above S3 URI of the layer zip, specifying runtime Python 3.11 and architecture x86.