Keith's Layers (Klayers)
A collection of AWS Lambda Layers for Python3.7
Status of layers
If the layers are ever outdated, click the badge above for more info.
Full list of publicly available layers are here. Summary list is below.
Python Packages (in alphabetical order)
1 Includes leptonica-1.76.0, libjpeg 6b (libjpeg-turbo 1.2.90) : libpng 1.2.49 : libtiff 4.0.3 : zlib 1.2.8 : libwebp 0.3.0
Using the Layers
You can either:
- Set any of the ARNs above (for your region) to be a layer for your function.
- Download the zip file from the directory of your package name in the packages directory (e.g. requests) and upload as a layer to your function
Currently only the following regions have the layers deployed:
Whenever there is an new version of the underlying package, a new layer may be created with an incremented version number.
Building your own layer
To build a layer containing a single python package run the following in the packages directory:
$ package.sh -p <package_name> -l <license> -r <runtime> -x <public/private> -a <aws_region>
$ package.sh -x public -a ap-southeast-1 -p requests -r python3.7 -l Apache-2.0 $ package.sh -x private -a ap-southeast-1 -p beautifulsoup4 -r python3.7 -l MIT $ package.sh -p sqlite3 -r python3.7 -l Apache-2.0
- -p : (MANDATORY) Package Name
- -l : (MANDATORY) License information for the Package, use the SPDX license identifier
- -r : (MANDATORY) Runtime, currently only python3.7 is supported, but should work for python2.7 and python3.6
- -x : (OPTIONAL) set to public to make layer publicly accessible defaults to private
- -a : (OPTIONAL) aws regiondefaults to deploying layer in all aws_regions where lambda is available (except China)
- -b : (OPTIONAL) bypass flag to upload layers even if previous upload has the same hash
Asking for more layers
Make a pull requests!
All layers are deployed in every region (except China). Refer to the arns.json file for more info.
I intend to delete older layers after a while. Functions relying on deleted layers will still work after the layers are deleted. But you won't be able to create new functions referencing older layers.
Layer specific notes
tldextract, set the following environment variable to avoid trying to query the Mozilla tld file from the internet.
pytesseract, the tesseract binary is not included in the build, but the layer includes Pillow. To use tesseract you'd need the tesseract binary layer as well.
spacy, I had to manually tweak a few things to make the package fit into a layer, it only works for English, consider this beta. To use the included model:
boto3, the current version (as of Apr-2019) of boto3 available in the lambda environment is 1.9.42 for python 3.7 which is ~5 months out of date, and ~100 versions ago. Placing the latest version of boto3 in case anyone needs it.