Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save krishnamurthydasari/aa913fa8cdd40eb0f5fed9e9a7b23a1d to your computer and use it in GitHub Desktop.
Save krishnamurthydasari/aa913fa8cdd40eb0f5fed9e9a7b23a1d to your computer and use it in GitHub Desktop.
Create Deployment Package Using Python Environment Created with Virtualenv
Below are the steps to Create Deployment Package Using a Python Environment Created with Virtualenv. Below are the 2 examples for pymysql and boto2 modules.
pymysql:
1. Create a directory
2. Create virtual environment
#virtualenv test
3. #cd test
4. #source bin/activate
5. install third party modules
#pip install pymysql
6. #cd lib64/python2.7/site-packages/
7. copy python code script here that you intend to run in lambda for example test.py
8. create zip file along with modules
#zip -r test.zip test.py pymysql*
9. upload zip file to lambda
Boto:
1. Create a directory
2. Create virtual environment
#virtualenv test
3. #cd test
4. #source bin/activate
5. install third party modules
#pip install boto
6. #cd lib/python2.7/site-packages/
7. copy python code script here for example rdstest.zip
8. create zip file along with modules. rdstest.py is the python script and boto* will add all boto related modules to zip file
#zip -r rdstest.zip rdstest.py boto*
9. upload zip file to lambda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment