Zappa

0.62.1 · active · verified Thu Apr 16

Zappa is a Python library that simplifies the deployment of serverless Python web applications (WSGI and ASGI-compatible frameworks like Flask, Django, FastAPI, Bottle, Starlette, Quart) on AWS Lambda and API Gateway. It handles packaging the application and its virtual environment, configuring IAM roles, setting up API Gateway routes, and managing deployments to various stages. It is currently at version 0.62.1 and maintains an active release cadence.

Common errors

Warnings

Install

Quickstart

This quickstart demonstrates how to deploy a simple Flask application to AWS Lambda using Zappa. After creating your Flask app, you initialize Zappa with `zappa init`, which guides you through creating a `zappa_settings.json` file. This file specifies your application's entry point, AWS region, runtime, and other deployment settings. Once configured, you can deploy your application with `zappa deploy <stage_name>` and manage updates or undeployments with corresponding commands. Ensure your AWS credentials are configured (e.g., via `aws configure`).

# 1. Create a Flask app (e.g., app.py)
# pip install Flask
from flask import Flask
import os

app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello from Zappa on Lambda!'

if __name__ == '__main__':
    app.run(debug=True)

# 2. Initialize Zappa in your project directory (where app.py is)
#    Run 'zappa init' and follow the prompts.
#    Example zappa_settings.json will be generated:
#
#    {
#        "dev": {
#            "app_function": "app.app",
#            "aws_region": "us-east-1",
#            "profile_name": "default",
#            "project_name": "my-flask-app",
#            "runtime": "python3.9",
#            "s3_bucket": "zappa-my-flask-app"
#        }
#    }
#
# 3. Deploy your application
# zappa deploy dev
#
# 4. Update your application
# zappa update dev
#
# 5. Undeploy your application
# zappa undeploy dev

view raw JSON →