Here is good reference for this subject:
If we use docker then it's very simple.
Let's go through step by step
1. make Main folder & python library folder
ex) In this tutorial, we suppose to need flask package
2. make requirements.txt and put packages to install by pip
So folder structure looks like this:
├── requirements.txt └── python/ └── lib/ ├── python3.6/ │ └── site-packages/ └── python3.8/ └── site-packages/
3. Run docker to install packages
note, change python version properly
4. compress package to zip
5. use zip file for your lambda
That's it all.