Zappa - Serverless Python
- About
- Quick Reference
- Installation and Configuration
- Basic Usage
- Executing in Response to AWS Events
- Asynchronous Task Execution
- Advanced Settings
- Advanced Usage
- Keeping The Server Warm
- Enabling CORS
- Large Projects
- Enabling Bash Completion
- Enabling Secure Endpoints on API Gateway
- Setting Environment Variables
- API Gateway Context Variables
- Catching Unhandled Exceptions
- Using Custom AWS IAM Roles and Policies
- AWS X-Ray
- Globally Available Server-less Architectures
- Raising AWS Service Limits
- Dead Letter Queues
- Elastic File System (EFS)
- Unique Package ID
- Application Load Balancer Event Source
- ASGI Support
- WebSocket Support
- Endpoint Configuration
- Cold Starts (Experimental)
- Lambda Test Console Usage
- Community
- Contributing
About
In a hurry? Click to see (now slightly out-dated) slides from Serverless SF!
Zappa builds and deploys server-less, event-driven Python applications (including, but not limited to, WSGI and ASGI web apps) on AWS Lambda + API Gateway. Think of it as "serverless" web hosting for your Python apps. That means infinite scaling, zero downtime, zero maintenance - and at a fraction of the cost of your current deployments!
If you've got a Python web app (including Django, Flask, FastAPI, and Starlette apps), it's as easy as:
$ pip install zappa
$ zappa init
$ zappa deploy
and now you're server-less!
What do you mean "serverless"?
Okay, so there still is a server - but it only has a 40 millisecond life cycle! Serverless in this case means "without any permanent infrastructure."
With a traditional HTTP server, the server is online 24/7, processing requests one by one as they come in. If the queue of incoming requests grows too large, some requests will time out. With Zappa, each request is given its own virtual HTTP "server" by Amazon API Gateway. AWS handles the horizontal scaling automatically, so no requests ever time out. Each request then calls your application from a memory cache in AWS Lambda and returns the response via Python's WSGI interface. After your app returns, the "server" dies.
With Zappa you only pay for the milliseconds of server time that you use, so it's many orders of magnitude cheaper than VPS/PaaS hosts like Linode or Heroku - and in most cases, it's completely free. Plus, there's no need to worry about load balancing or keeping servers online ever again.
It's great for deploying serverless microservices with frameworks like Flask and Bottle, and for hosting larger web apps and CMSes with Django. Zappa also supports ASGI frameworks like FastAPI, Starlette, and Quart — deploy async Python apps to Lambda with the same ease. You can use any WSGI or ASGI-compatible app you like! You probably don't need to change your existing applications to use it, and you're not locked into using it.
Zappa also lets you build hybrid event-driven applications with free SSL certificates, **global app dep
