Skip to content

Instantly share code, notes, and snippets.



Last active Feb 13, 2017
What would you like to do?
Setting Up Build Environment of AWS Lambda
set -e -x
yum -y update
yum -y upgrade
yum -y groupinstall "Development Tools"
yum -y install zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel git
export HOME=/home/ec2-user
export PYENV_ROOT=/var/task/pyenv
mkdir -p $LAMBDA
curl -L | bash
cat << 'EOT' >> $HOME/.bash_profile
export PATH="/var/task/pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
. $HOME/.bash_profile
hash -r
pyenv install 3.5.1
cd pyenv
shopt -s extglob
rm -fr !(versions) .git
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | sudo xargs rm -rf
cd versions/3.5.1/bin/
rm python3.5m
ln -s python3.5 python3.5m
pyenv/versions/3.5.1/bin/pip install --upgrade pip
pyenv/versions/3.5.1/bin/pip install virtualenv
pyenv/versions/3.5.1/bin/virtualenv .venv
pyenv/versions/3.5.1/bin/virtualenv --relocatable .venv
chown -R ec2-user:ec2-user $LAMBDA
zip --symlinks -r ~/ .
aws s3 cp ~/ s3://$BUCKET/lambda-deploy/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.