How to Handle your Python packaging in Lambda with Serverless plugins

Python is my go-to language, but handling Python packages in Lambda can be tricky. So in this blog i will tell you how you can Handel your python package in Lambda with serverless plugins.

Here few steps using you can handle your python package in Lambda function

Step 1- You need to install serverless-python-requirements

Step 2- Then add the following to your serverless.yml

Step 3- Make sure you have your python virtual environment active in CLI

Step 4- Install any dependencies with pip — note that in CLI you can tell if venv is active by the venv to the left of the terminal text

Step 5- Now, deploy your function

What will happen is that serverless-python-requirements will build you python packages in docker using a lambda environment, and then zip them up ready to be uploaded with the rest of your code.



Software developer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store