This guide will show you, step by step, how to build a real application using Flask (a Python-based web microframework) and how to run it on AWS Lambda (Amazon's 'serverless' cloud function service). In a sense it's three small manuals in one: a Flask tutorial, a Zappa tutorial, and a partial AWS boto3 tutorial, complete with code and configurations.

For the rest of this introduction I'll be giving an overview of the arc of the guide, so if you'd like to dig right into the content then skip to the next chapter now.

I wrote this guide for two reasons:

  1. I think serverless flask is a great, inexpensive option for applications that need to auto-scale quickly and/or have extremely bursty usage (for instance, a reporting tool that is only used on the first of every month, or an application that only accepts submissions for small windows of time throughout the year). It's also a wonderful option for people who want to deploy quick one-off web apps that can stay up indefinitely with no monthly cost if people aren't using them.
  2. I want to show you how to build a complete Python web application that is actually deployable and usable. Many books use toy applications without full source code, whereas I want to demonstrate how to build a real (albeit simple) application from start to finish. All the source code is available as an appendix at the end of the guide (in addition to a github repo here) and relevant excerpts will be presented throughout.

The application we'll be building is one that I use in production for my science fiction magazine: a tool to allow authors to edit their own biographies on For the purposes of this guide, we'll call the application the descriptive and unimaginative "Profile App".

The general structure of the guide looks like this:

  1. Setup: An overview of how to create a virtual environment and a brief summary of the packages we'll be using.
  2. Flask: An overview of this Python web microframework and the start of our Profile App.
  3. DynamoDB: How do we interact with this non-relational database via the boto3 library?
  4. Registration, authentication, and email confirmation: Let's add them.
  5. Zappa: What it is and how we'll use it.
  6. Custom domains: Get a free SSL certificate and configure our app to use a custom domain.
  7. IAM roles: Finally, let's make everything more secure.

I believe that for most learners understanding flows from the concrete to the abstract, so whenever possible I will give a working example along with each explanation. Additionally, for those who want more detail I have released the full source code to my author profile app on GitHub. Additionally, the chapters each provide a fairly self-contained explanation of a single skill — I expect you to jump around and skip sections based on your needs and prior knowledge. Now that you have an aerial map of the land, let's begin our excursion!

If you're finding this guide useful, you may want to sign up to receive more of my writing at