Packaging dependencies on Windows to deploy on lambda (Linux)

ag
2 min readMay 9, 2019

This is mainly used to help you skip the issue of deploying windows libraries onto aws lambda and breaking your system.

As mentioned by Amazon, Lambda runs on the Amazon Linux operating system, so this guide will be replicating this environment using the amazon Linux docker image to download and build dependencies.

Requirements:

Docker

First, we are going to create a shared folder between our container and our windows host, For this example, our shared folder will be located at

C:/shared/

Next, we are going to need to pull the container image from the amazon linux repository, so we need to use the following command

docker pull amazonlinux

Then we need to run the container with the shared folder as a volume using the following command

docker run -ti -v C:/shared:/shared amazonlinux

Now you will be greeted with the container’s terminal

Lets go to our shared directory

cd /shared/

Then into our source file directory

cd exampleproject

Depending on the language used you’ll want to build the project from the container’s terminal

For example for python we

pip install -r requirements.txt

Or nodejs

npm i

Then we’ll package our files into a zip file

zip package.zip * .*

Then we’ll upload the zip file found in our shared folder to aws lamda

Note: You can also deploy the package directly from the container using aws cli using the update-function-code command

--

--