{ "info": { "author": "Rich Jones", "author_email": "rich@openwatch.net", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Framework :: Django", "Framework :: Django :: 1.11", "Framework :: Django :: 2.0", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "
\n
\n
\n In a hurry? Click to see (now slightly out-dated) slides from Serverless SF!\n
\n\n**Zappa** makes it super easy to build and deploy server-less, event-driven Python applications (including, but not limited to, WSGI 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!\n\nIf you've got a Python web app (including Django and Flask apps), it's as easy as:\n\n```\n$ pip install zappa\n$ zappa init\n$ zappa deploy\n```\n\nand now you're server-less! _Wow!_\n\n> What do you mean \"serverless\"?\n\nOkay, so there still is a server - but it only has a _40 millisecond_ life cycle! Serverless in this case means **\"without any permanent infrastructure.\"**\n\nWith 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.\n\nBetter still, 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.\n\nIt's great for deploying serverless microservices with frameworks like Flask and Bottle, and for hosting larger web apps and CMSes with Django. Or, you can use any WSGI-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.\n\nZappa also lets you build hybrid event-driven applications that can scale to **trillions of events** a year with **no additional effort** on your part! You also get **free SSL certificates**, **global app deployment**, **API access management**, **automatic security policy generation**, **precompiled C-extensions**, **auto keep-warms**, **oversized Lambda packages**, and **many other exclusive features**!\n\nAnd finally, Zappa is **super easy to use**. You can deploy your application with a single command out of the box!\n\n__Awesome!__\n\n\n
\n
\n Click to see slides from ServerlessConf London!\n
\n\nDuring the `init` process, you will be given the option to deploy your application \"globally.\" This will allow you to deploy your application to all available AWS regions simultaneously in order to provide a consistent global speed, increased redundancy, data isolation, and legal compliance. You can also choose to deploy only to \"primary\" locations, the AWS regions with `-1` in their names.\n\nTo learn more about these capabilities, see [these slides](https://htmlpreview.github.io/?https://github.com/Miserlou/Talks/blob/master/serverless-london/global.html#0) from ServerlessConf London.\n\n### Raising AWS Service Limits\n\nOut of the box, AWS sets a limit of [1000 concurrent executions](http://docs.aws.amazon.com/lambda/latest/dg/limits.html) for your functions. If you start to breach these limits, you may start to see errors like `ClientError: An error occurred (LimitExceededException) when calling the PutTargets..\"` or something similar.\n\nTo avoid this, you can file a [service ticket](https://console.aws.amazon.com/support/home#/) with Amazon to raise your limits up to the many tens of thousands of concurrent executions which you may need. This is a fairly common practice with Amazon, designed to prevent you from accidentally creating extremely expensive bug reports. So, before raising your service limits, make sure that you don't have any rogue scripts which could accidentally create tens of thousands of parallel executions that you don't want to pay for.\n\n### Using Zappa With Docker\n\nIf Docker is part of your team's CI, testing, or deployments, you may want to check out [this handy guide](https://blog.zappa.io/posts/simplified-aws-lambda-deployments-with-docker-and-zappa) on using Zappa with Docker.\n\n### Dead Letter Queues\n\nIf you want to utilise [AWS Lambda's Dead Letter Queue feature](http://docs.aws.amazon.com/lambda/latest/dg/dlq.html) simply add the key `dead_letter_arn`, with the value being the complete ARN to the corresponding SNS topic or SQS queue in your `zappa_settings.json`.\n\nYou must have already created the corresponding SNS/SQS topic/queue, and the Lambda function execution role must have been provisioned with read/publish/sendMessage access to the DLQ resource.\n\n### Unique Package ID\n\nFor monitoring of different deployments, a unique UUID for each package is available in `package_info.json` in the root directory of your application's package. You can use this information or a hash of this file for such things as tracking errors across different deployments, monitoring status of deployments and other such things on services such as Sentry and New Relic. The package will contain:\n\n```json\n{\n \"build_platform\": \"darwin\",\n \"build_user\": \"frank\",\n \"build_time\": \"1509732511\",\n \"uuid\": \"9c2df9e6-30f4-4c0a-ac4d-4ecb51831a74\"\n}\n```\n\n### Application Load Balancer Event Source\n\nZappa can be used to handle events triggered by Application Load Balancers (ALB). This can be useful in a few circumstances:\n- Since API Gateway has a hard limit of 30 seconds before timing out, you can use an ALB for longer running requests.\n- API Gateway is billed per-request; therefore, costs can become excessive with high throughput services. ALBs pricing model makes much more sense financially if you're expecting a lot of traffic to your Lambda.\n- ALBs can be placed within a VPC, which may make more sense for private endpoints than using API Gateway's private model (using AWS PrivateLink).\n\nLike API Gateway, Zappa can automatically provision ALB resources for you. You'll need to add the following to your `zappa_settings`:\n```\n\"alb_enabled\": true,\n\"alb_vpc_config\": {\n \"CertificateArn\": \"arn:aws:acm:us-east-1:[your-account-id]:certificate/[certificate-id]\",\n \"SubnetIds\": [\n // Here, you'll want to provide a list of subnets for your ALB, eg. 'subnet-02a58266'\n ],\n \"SecurityGroupIds\": [\n // And here, a list of security group IDs, eg. 'sg-fbacb791'\n ]\n}\n\nMore information on using ALB as an event source for Lambda can be found [here](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html).\n\n*An important note*: right now, Zappa will provision ONE lambda to ONE load balancer, which means using `base_path` along with ALB configuration is currently unsupported.\n\n### Endpoint Configuration\n\nAPI Gateway can be configured to be only accessible in a VPC. To enable this; [configure your VPC to support](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-apis.html) then set the `endpoint_configuration` to `PRIVATE` and set up Resource Policy on the API Gateway. A note about this; if you're using a private endpoint, Zappa won't be able to tell if the API is returning a successful status code upon deploy or update, so you'll have to check it manually to ensure your setup is working properly.\n\nFor full list of options for endpoint configuration refer to [API Gateway EndpointConfiguration documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-endpointconfiguration.html)\n\n#### Example Private API Gateway configuration\n\nzappa_settings.json:\n```json\n{\n \"dev\": {\n ...\n \"endpoint_configuration\": [\"PRIVATE\"],\n \"apigateway_policy\": \"apigateway_resource_policy.json\",\n ...\n },\n ...\n}\n```\n\napigateway_resource_policy.json:\n```json\n{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Deny\",\n \"Principal\": \"*\",\n \"Action\": \"execute-api:Invoke\",\n \"Resource\": \"execute-api:/*\",\n \"Condition\": {\n \"StringNotEquals\": {\n \"aws:sourceVpc\": \"{{vpcID}}\" // UPDATE ME\n }\n }\n },\n {\n \"Effect\": \"Allow\",\n \"Principal\": \"*\",\n \"Action\": \"execute-api:Invoke\",\n \"Resource\": \"execute-api:/*\"\n }\n ]\n}\n```\n\n## Zappa Guides\n\n* [Django-Zappa tutorial (screencast)](https://www.youtube.com/watch?v=plUrbPN0xc8&feature=youtu.be).\n* [Using Django-Zappa, Part 1](https://serverlesscode.com/post/zappa-wsgi-for-python/).\n* [Using Django-Zappa, Part 2: VPCs](https://serverlesscode.com/post/zappa-wsgi-for-python-pt-2/).\n* [Building Serverless Microservices with Zappa and Flask](https://gun.io/blog/serverless-microservices-with-zappa-and-flask/)\n* [Zappa \u3067 Hello World \u3059\u308b\u307e\u3067 (Japanese)](http://qiita.com/satoshi_iwashita/items/505492193317819772c7)\n* [How to Deploy Zappa with CloudFront, RDS and VPC](https://jinwright.net/how-deploy-serverless-wsgi-app-using-zappa/)\n* [Secure 'Serverless' File Uploads with AWS Lambda, S3, and Zappa](http://blog.stratospark.com/secure-serverless-file-uploads-with-aws-lambda-s3-zappa.html)\n* [First Steps with AWS Lambda, Zappa and Python](https://andrich.blog/2017/02/12/first-steps-with-aws-lambda-zappa-flask-and-python/)\n* [Deploy a Serverless WSGI App using Zappa, CloudFront, RDS, and VPC](https://docs.google.com/presentation/d/1aYeOMgQl4V_fFgT5VNoycdXtob1v6xVUWlyxoTEiTw0/edit#slide=id.p)\n* [AWS: Deploy Alexa Ask Skills with Flask-Ask and Zappa](https://developer.amazon.com/blogs/post/8e8ad73a-99e9-4c0f-a7b3-60f92287b0bf/New-Alexa-Tutorial-Deploy-Flask-Ask-Skills-to-AWS-Lambda-with-Zappa)\n* [Guide to using Django with Zappa](https://edgarroman.github.io/zappa-django-guide/)\n* [Zappa and LambCI](https://seancoates.com/blogs/zappa-and-lambci/)\n* [Building A Serverless Image Processing SaaS using Zappa](http://www.99serverless.com/index.php/2017/11/25/building-a-serverless-image-processing-saas/)\n* [Serverless Slack Slash Commands with Python and Zappa](https://renzo.lucioni.xyz/serverless-slash-commands-with-python/)\n* [Bringing Tokusatsu to AWS using Python, Flask, Zappa and Contentful](https://www.contentful.com/blog/2018/03/07/bringing-tokusatsu-to-aws-using-python-flask-zappa-and-contentful/)\n* [AWS Summit 2018 Seoul - Zappa\uc640 \ud568\uaed8\ud558\ub294 Serverless Microservice](https://www.slideshare.net/YunSeopSong/zappa-serverless-microservice-94410308/)\n* [Book - Building Serverless Python Web Services with Zappa](https://github.com/PacktPublishing/Building-Serverless-Python-Web-Services-with-Zappa)\n* _Your guide here?_\n\n## Zappa in the Press\n\n* _[Zappa Serves Python, Minus the Servers](http://www.infoworld.com/article/3031665/application-development/zappa-serves-python-web-apps-minus-the-servers.html)_\n* _[Zappa lyfter serverl\u00f6sa applikationer med Python](http://computersweden.idg.se/2.2683/1.649895/zappa-lyfter-python)_\n* _[Interview: Rich Jones on Zappa](https://serverlesscode.com/post/rich-jones-interview-django-zappa/)_\n* [Top 10 Python Libraries of 2016](https://tryolabs.com/blog/2016/12/20/top-10-python-libraries-of-2016/)\n\n## Sites Using Zappa\n\n* [Zappa.io](https://www.zappa.io) - A simple Zappa homepage\n* [Zappatista!](https://blog.zappa.io) - The official Zappa blog!\n* [Mailchimp Signup Utility](https://github.com/sasha42/Mailchimp-utility) - A microservice for adding people to a mailing list via API.\n* [Zappa Slack Inviter](https://github.com/Miserlou/zappa-slack-inviter) - A tiny, server-less service for inviting new users to your Slack channel.\n* [Serverless Image Host](https://github.com/Miserlou/serverless-imagehost) - A thumbnailing service with Flask, Zappa and Pillow.\n* [Zappa BitTorrent Tracker](https://github.com/Miserlou/zappa-bittorrent-tracker) - An experimental server-less BitTorrent tracker. Work in progress.\n* [JankyGlance](https://github.com/Miserlou/JankyGlance) - A server-less Yahoo! Pipes replacement.\n* [LambdaMailer](https://github.com/tryolabs/lambda-mailer) - A server-less endpoint for processing a contact form.\n* [Voter Registration Microservice](https://topics.arlingtonva.us/2016/11/voter-registration-search-microservice/) - Official backup to to the Virginia Department of Elections portal.\n* [FreePoll Online](https://www.freepoll.online) - A simple and awesome say for groups to make decisions.\n* [PasteOfCode](https://paste.ofcode.org/) - A Zappa-powered paste bin.\n* And many more, including banks, governments, startups, enterprises and schools!\n\nAre you using Zappa? Let us know and we'll list your site here!\n\n## Related Projects\n\n* [lambda-packages](http://github.com/Miserlou/lambda-packages) - Precompiled C-extension packages for AWS Lambda. Used automatically by Zappa.\n* [Mackenzie](http://github.com/Miserlou/Mackenzie) - AWS Lambda Infection Toolkit\n* [NoDB](https://github.com/Miserlou/NoDB) - A simple, server-less, Pythonic object store based on S3.\n* [zappa-cms](http://github.com/Miserlou/zappa-cms) - A tiny server-less CMS for busy hackers. Work in progress.\n* [zappa-django-utils](https://github.com/Miserlou/zappa-django-utils) - Utility commands to help Django deployments.\n* [flask-ask](https://github.com/johnwheeler/flask-ask) - A framework for building Amazon Alexa applications. Uses Zappa for deployments.\n* [zappa-file-widget](https://github.com/anush0247/zappa-file-widget) - A Django plugin for supporting binary file uploads in Django on Zappa.\n* [zops](https://github.com/bjinwright/zops) - Utilities for teams and continuous integrations using Zappa.\n* [cookiecutter-mobile-backend](https://github.com/narfman0/cookiecutter-mobile-backend/) - A `cookiecutter` Django project with Zappa and S3 uploads support.\n* [zappa-examples](https://github.com/narfman0/zappa-examples/) - Flask, Django, image uploads, and more!\n* [zappa-hug-example](https://github.com/mcrowson/zappa-hug-example) - Example of a Hug application using Zappa.\n* [Zappa Docker Image](https://github.com/danielwhatmuff/zappa) - A Docker image for running Zappa locally, based on Lambda Docker.\n* [zappa-dashing](https://github.com/nikos/zappa-dashing) - Monitor your AWS environment (health/metrics) with Zappa and CloudWatch.\n* [s3env](https://github.com/cameronmaske/s3env) - Manipulate a remote Zappa environment variable key/value JSON object file in an S3 bucket through the CLI.\n* [zappa_resize_image_on_fly](https://github.com/wobeng/zappa_resize_image_on_fly) - Resize images on the fly using Flask, Zappa, Pillow, and OpenCV-python.\n* [zappa-ffmpeg](https://github.com/ubergarm/zappa-ffmpeg) - Run ffmpeg inside a lambda for serverless transformations.\n* [gdrive-lambda](https://github.com/richiverse/gdrive-lambda) - pass json data to a csv file for end users who use Gdrive across the organization.\n* [travis-build-repeat](https://github.com/bcongdon/travis-build-repeat) - Repeat TravisCI builds to avoid stale test results.\n* [wunderskill-alexa-skill](https://github.com/mcrowson/wunderlist-alexa-skill) - An Alexa skill for adding to a Wunderlist.\n* [xrayvision](https://github.com/mathom/xrayvision) - Utilities and wrappers for using AWS X-Ray with Zappa.\n* [terraform-aws-zappa](https://github.com/dpetzold/terraform-aws-zappa) - Terraform modules for creating a VPC, RDS instance, ElastiCache Redis and CloudFront Distribution for use with Zappa.\n* [zappa-sentry](https://github.com/jneves/zappa-sentry) - Integration with Zappa and Sentry\n* [IOpipe](https://github.com/iopipe/iopipe-python#zappa) - Monitor, profile and analyze your Zappa apps.\n\n\n## Hacks\n\nZappa goes quite far beyond what Lambda and API Gateway were ever intended to handle. As a result, there are quite a few hacks in here that allow it to work. Some of those include, but aren't limited to..\n\n* Using VTL to map body, headers, method, params and query strings into JSON, and then turning that into valid WSGI.\n* Attaching response codes to response bodies, Base64 encoding the whole thing, using that as a regex to route the response code, decoding the body in VTL, and mapping the response body to that.\n* Packing and _Base58_ encoding multiple cookies into a single cookie because we can only map one kind.\n* Forcing the case permutations of \"Set-Cookie\" in order to return multiple headers at the same time.\n* Turning cookie-setting 301/302 responses into 200 responses with HTML redirects, because we have no way to set headers on redirects.\n\n## Contributing\n\nThis project is still young, so there is still plenty to be done. Contributions are more than welcome!\n\nPlease file tickets for discussion before submitting patches. Pull requests should target `master` and should leave Zappa in a \"shippable\" state if merged.\n\nIf you are adding a non-trivial amount of new code, please include a functioning test in your PR. For AWS calls, we use the `placebo` library, which you can learn to use [in their README](https://github.com/garnaat/placebo#usage-as-a-decorator). The test suite will be run by [Travis CI](https://travis-ci.org/Miserlou/Zappa) once you open a pull request.\n\nPlease include the GitHub issue or pull request URL that has discussion related to your changes as a comment in the code ([example](https://github.com/Miserlou/Zappa/blob/fae2925431b820eaedf088a632022e4120a29f89/zappa/zappa.py#L241-L243)). This greatly helps for project maintainability, as it allows us to trace back use cases and explain decision making. Similarly, please make sure that you meet all of the requirements listed in the [pull request template](https://raw.githubusercontent.com/Miserlou/Zappa/master/.github/PULL_REQUEST_TEMPLATE.md).\n\nPlease feel free to work on any open ticket, especially any ticket marked with the \"help-wanted\" label. If you get stuck or want to discuss an issue further, please join [our Slack channel](https://slack.zappa.io), where you'll find a community of smart and interesting people working dilligently on hard problems.\n\nZappa does not intend to conform to PEP8, isolate your commits so that changes to functionality with changes made by your linter.\n\n#### Using a Local Repo\n\nTo use the git HEAD, you *probably can't* use `pip install -e `. Instead, you should clone the repo to your machine and then `pip install /path/to/zappa/repo` or `ln -s /path/to/zappa/repo/zappa zappa` in your local project.\n\n## Patrons\n\nIf you or your company uses **Zappa**, please consider giving what you can to support the ongoing development of the project!\n\nYou can become a patron by **[visiting our Patreon page](https://patreon.com/zappa)**.\n\nZappa is currently supported by these awesome individuals and companies:\n\n * Nathan Lawrence\n * LaunchLab\n * Sean Paley\n * Theo Chitayat\n * George Sibble\n * Joe Weiss\n * Nik Bora\n * Zerong Toby Wang\n * Gareth E\n * Matt Jackson\n * Sean Coates\n * Alexander Loschilov\n * Korey Peters\n * Joe Weiss\n * Kimmo Parvianen-Jalanko\n * Patrick Agin\n * Roberto Martinez\n * Charles Dimino\n * Doug Beney\n * Dan \"The Man\" Gayle\n * Juancito\n * Will Childs-Klein\n * Efi Merdler Kravitz\n * **Philippe Trounev**\n\nThank you very, very much!\n\n## Merch\n\n