Preparing your Local Development Environment For AWS Lambda and Python Development

We can comfortably develop for AWS Lambda with python on any modern Operating System

We can comfortably develop for AWS Lambda with python on any modern Operating System. Almost any up-to-date version of Linux, MacOS, or Windows will support the software tooling. The most demanding piece of software from a local-hardware perspective is Docker which is used for replicating production Lambda environments and executing tests. It is possible to develop and deploy without docker, but not recommended.

We are going to provide complete setup and install instructions for local development workstations with the following configurations below. If your workstation configuration is not listed below - it's still possible that core the tooling can work so long as docker and python 3.7.4 can be installed. Due to space constraints though, we are going to focus on the most common configurations that we know work.

Operating Systems : Windows:: Windows 10 Professional 64bit with latest updates for Windows Subsystem for Linux : Mac OS: Sierra 10.12+ : Linux: Amazon Linux 2, Ubuntu 18.04+

Hardware: : CPU: x86_64 architecture : RAM: 4GB+

For the purpose of demonstration, examples shown throughout this course have been executed on a AWS Amazon Linux 2.

Software used in this course#

This course will provide full install steps for each of the packages below. The version listed here is the version used at time of writing and testing from this course.

NOTE: If your local workstation configuration is unsupported, or you have permissions restrictions on your workspace that prevent you from installing any of the software listed above - you may still be able to develop by using a client for AWS Workspaces as explained in more detail in the Remote Workspace section.

Selecting a code editor for python development#

Python 3 support is available for many popular, general-purpose editors, either natively or through the use of plug-ins. For readers who already have high proficiency and comfort using a specific editor - don’t feel pressured to switch to something more specialized. Code-highlighting and linting features are available for almost every editor, though it may require a plugin to get them configured.

For the rest of us - VSCode or PyCharm are solid options for providing a fully featured python IDE experience right out-of-the-box.

VSCode : VSCode is maintained by Microsoft and released under the MIT License.

PyCharm : PyCharm is maintained by Jetbrains, and provides two editions. One that requires purchase a professional license, and a community edition, licensed under Apache 2.

Both editors are supported on all major operating systems and are widely used within the Python developer community. They have first-class support for Python and comprehensive documentation available. Either is an excellent choice. For the purpose of this course, any editor examples will use VSCode.

Install docker#

Docker updates so frequently it's always best just to check the latest docs at

Account Setup at Docker Hub Possibly Required

Docker has started to re-direct users through to an account sign-up process to download the latest products. Linux users don't need to do that in most cases, but others who wish to use the latest Docker Desktop may need to sign up. They don't request a credit card to sign up, but will ask for an email. Docker Desktop isn't strictly required, so if you have a functioning older version of docker, it may be easier to just update that one in place to avoid the sign-up process.

Install docker on Mac OS#

The AWS SAM CLI supports Docker running on macOS Sierra 10.12 or above. AWS recommends using Docker Desktop for Mac.

For older version of MacOS, Docker Toolbox is available.

Install docker on Windows#

To install Docker for Windows 10 Professional, see Install Docker Desktop for Windows

For older or Non-Professional versions of Windows, use Docker Toolbox

Install docker on Linux (Amazon Linux 2)#

The version of docker in the Amazon Linux 2 works fine. No need to use the docker-specific repo.

After running usermod, log out and log back in for the permission changes to take effect. Failure to do this will result in all docker commands failings with a permission error.

Windows Subsystem for Linux (Optional - Windows 10 Only)#

Up-to-date versions of Windows 10 Professional provide a feature called Windows Subsystem for Linux which allows user run Linux commands on your windows workstation. If you have this available, it may be worth configuring to make it easier to follow along with the shell commands shown in this course.

Using WSL also ensures that you can use the native versions of the pyenv tool, and not the windows fork, pyenv-win. WSL is not strictly required though, and the work to get docker working with WSL is admittedly, not insignificant. That said, WSL was tested over the course of developing this course, and was found to work well after the initial setup was completed.

If you do choose to use WSL, be sure to follow the Ubuntu 18.04 instructions in all subsequent steps!

Enable Windows Subsystem for Linux (Optional-WSL)#

Install all pending Windows updates before attempting this.

First, we will open Powershell with Run as Administrator. This is accomplished by hitting the key with the windows icon, typing "power", and clicking the Run as Administrator option as shown below.

Next, paste the command below into Powershell and hit enter.

After that is complete, restart your computer for the changes to take effect.

Not Supported on Every Windows:

If you get errors here, it's possible that this feature is not supported on your operating system. If that's the case, don't fret, as WSL isn't a hard requirement. Just skip past anything with WSL in the title and follow the standard Windows Instructions for the next sections.

Install Ubuntu 18.04 (Optional - WSL)#

Install Ubuntu 18.04 from the Windows Store by searching for it there. It should say that the developer is Canonical.

Hit the blue Launch button on the Windows Store page after install is complete, and follow the prompts to finish installing it.

Setup Ubuntu on Windows

Install and use tmux (Optional - WSL)#

It's easy to accidentally close the WSL terminal and leave a process running that is now inaccessible. If this happens during package installation, it can cause a bit of a headache. A good way to prevent this problem is to use terminal-multiplexing software like tmux to re-attach if needed.

Tmux Cheatsheets

Search images on google for "tmux cheatsheet" to find some very helpful guides to tmux shortcuts. Print one of these out and keep it nearby if new to tmux.

Commands to install and start tmux:

If we accidentally closed our window and lost our spot, we can now get it back by opening a new terminal, and typing the command tmux attach.

Configure Docker Support for WSL#

This is the most painful part. Luckily, there is an amazing blog post written by the excellent Nick Janetakis, which describes the full process to get this working.


Next, we'll setup Python

Start a new discussion. All notification go to the author.