In order to deploy your python code to AWS Lambda we need to bundle all the script and dependecy in a zip folder with dependency placed in the root folder itself along with the source files. REPO
- sample.py
- dependency1
- dependency2
This script will help you to bundle your source code and dependency in a zip folder using python venv.
- Place
script-env.sh& 'requirements.txt' file in the root folder in your project. - Add all the project dependency in the requirements.txt file, 1 dependency per line
- In the
script-env.shfile underMove the relevant files into setup directorygive the path of all your project files which need to be packaged in the bundle.
- Run this
./script-env.shit will create apackage.zipfile.
- Upload
package.zipfile to AWS Lambda.