🐾Lambda development - Custom base image🐾
❓Lambda container functions are really useful for data and ML workloads, but sometimes you want to use Python version that AWS do not provide in base images. Also, you may want to use additional packages that are incompatible with Amazon Linux 2.
✅ To address these use cases, you can build your own image as a base image for container.
To create an image for Lambda from custom base image, you should add the following:
🔹Choose a base image with Amazon Linux 2, Alpine, CentOS, Debian, or Ubuntu Linux OS distribution.
🔹If chosen OS does not support manylinux2014 wheels Install, you need to install aws-lambda-cpp build dependencies such as g++, make, cmake, unzip and libcurl4-openssl-dev.
🔹 Install awslambdaric (AWS Lambda Python Runtime Interface Client) to allow your runtime to receive requests from and send requests to the Lambda service.
🔹Add ENTRYPOINT to run awslambdaric library with Python. As an example, for Debian Linux it can be [ "/usr/bin/python3", "-m", "awslambdaric" ]
Documentation: https://docs.aws.amazon.com/lambda/latest/dg/images-create.html#images-create-from-alt
If you like this post, you can share APAWS newsletter with friends: