Installing Python 3.6 for AWS Lambda Development

Python 3.6 is currently the only python 3.x version that AWS Lambda supports. I’m writing this post to document the installation process on the linux distributions I use.

Amazon Linux AMI 2017.09 or later

You can use Amazon Linux AMI 2017.09 or later.

sudo yum install python36 python36virtualenv python36pip

The Lamba execution environment uses Amazon Linux. Using this distribution ensures that modules with C extensions will be binary compatible.

 

Amazon Linux release 2 (2017.12) LTS Release Candidate

sudo yum install python3

 

Ubuntu 18.04 LTS

Python 3.6 is installed by default. :)

 

Ubuntu 16.04 LTS

You have a number of options for installing python 3.6 on this Ubuntu version. Check out this post for the list. I prefer to use J Fernyhough’s PPA.

sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6 python3.6-venv

 

I encourage pythonistas to try writing an app to be deployed on Lambda. Using the chalice framework vastly simplifies deployment.

Advertisements