Going serverless with Zappa

Joe Meilinger

Why serverless?

  • No infrastructure to manage!
  • Theoretically near-infinite scaling
  • Potential cost savings
  • Fewer moving parts

Serverless providers available

  • AWS Lambda
    • supports Java/Node/Python
  • Azure Functions
    • supports C#/F#/Javascript/Python/PHP/Powershell/Bash...
      and Batch?!?!
  • Google Cloud Functions, Iron.io, OpenWhisk, etc 

But today, we're going to focus on AWS Lambda

'cause it's what Zappa supports

What's Zappa?

  • Small Python framework that assists in deploying your Flask or Django application (or any WSGI-based application) into AWS Lambda
    • Uses CloudFormation templates to create a "stack" in AWS complete with API Gateway and Lambda function
    • Highly-configurable in terms of additional components:
      • Arbitrary function execution scheduler
      • SSL certificate creation (using Let's Encrypt)
      • API key generation for API Gateway

A simple demo API

  • Using Flask
> zappa init
> zappa deploy

What's going on?

1) Zappa packages your code and uploads to an S3 bucket

2) Apply infrastructure (CloudFormation) template

  • Creates API Gateway endpoints
  • Creates Lambda functions from your code

3) And...we're live

Gnarly caveat

  • Python packages with native bindings (eg. C/C++) MUST be built for Amazon Linux
    • However, there are quite a few pre-built packages that are supported
    • see https://github.com/Miserlou/lambda-packages

Questions?

Hit me up anytime @:

meilinger on https://stl-tech.slack.com[1]

joemeilinger@gmail.com

@joemeilinger

[1] get an invite @ https://stltech.herokuapp.com

Going serverless with Zappa

By Joe Meilinger

Going serverless with Zappa

In this talk, we'll explore using Zappa for creating and deploying APIs and full websites using AWS Lambda.

  • 443