- Newest
- Most votes
- Most comments
Hello.
The module called "cryptography" seems to be able to run in the environment described in the document below.
https://cryptography.io/en/latest/installation/
- x86-64 RHEL 8.x
- x86-64 CentOS 9 Stream
- x86-64 Fedora (latest)
- x86-64 macOS 13 Ventura and ARM64 macOS 14 Sonoma
- x86-64 Ubuntu 20.04, 22.04, rolling
- ARM64 Ubuntu 22.04
- x86-64 Debian Buster (10.x), Bullseye (11.x), Bookworm (12.x), Trixie (13.x), and Sid (unstable)
- x86-64 and ARM64 Alpine (latest)
- 32-bit and 64-bit Python on 64-bit Windows Server 2022
So, I think it is possible to create a layer using a Docker container as shown below.
https://repost.aws/knowledge-center/lambda-layer-simulated-docker
As I answered at the URL below, if you can use Docker, you can also use Amazon Linux2 container images.
https://repost.aws/questions/QUmvP42wYQRiyOJmvDI5MVtA/error-while-running-python-code-in-aws-lambda-function#ANQ8ctoPV9Q72nMUr5mh8ulg
Recently, it has become possible to use Docker with CloudShell, so it may be a good idea to create a Lambda layer with CloudShell.
https://docs.aws.amazon.com/cloudshell/latest/userguide/working-with-aws-cloudshell.html#working-with-docker
Because Lambda does not supply a Windows runtime you will not be able to run a package compiled for Windows on Lambda.
However, adding onto @Riku_Kobayashi's answer with an example.
You can try this on your local machine and then apply it to any of the automated build systems out there like GitHub Actions or CircleCI.
STEPS
-
Install Docker Desktop or Rancher Desktop. Reboot if necessary.
-
Review this script install-dependencies.sh and download it to where your python application is. Modify as needed. It will install the dependencies in the container, leaving a
dependencies.zip
in the directory where you run it. -
Build the ZIP by running the container in your project directory with the command:
docker run -v "${PWD}:/var/task" --cpuset-cpus="0,1" --cpus=2 "amazonlinux:2023" /bin/sh -c "/var/task/install-dependencies.sh"
Relevant content
- asked 3 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago
Do you have or know how to use Docker on windows? Also how will you deploy your lambda package; Github Actions, CircleCI, something custom?