create EC2 for package preparation
sudo apt-get update
sudo apt-get install python-pip python-dev build-essential
pip install --upgrade pip
pip install virtualenv
-----------init.sh---------
virtualenv env
source env/bin/activate
pip install -r requirements.txt
cd $VIRTUAL_ENV/lib/python2.7/site-packages
zip -r9 ~/lambda.zip *cd $VIRTUAL_ENV/lib64/python2.7/site-packages
zip -r9 ~/lambda.zip *
cd $VIRTUAL_ENV/..
zip -g ~/lambda.zip main.py
-----------requirements.txt---------
numpy==1.12.0
-----------requirements.txt---------
import numpy as np
def myfunction(event=None, context=None):
mylist=[
'My name is Wasit', 'Rule the world!!',
'get data, process and turn on the switch',
'get data and predict your future', 'keep coding',
]
return np.random.randint(0, len(mylist))
if __name__ == "__main__":
print myfunction()
No comments:
Post a Comment