Book Image

Building Serverless Python Web Services with Zappa

By : Abdulwahid Abdulhaque Barguzar
Book Image

Building Serverless Python Web Services with Zappa

By: Abdulwahid Abdulhaque Barguzar

Overview of this book

Serverless applications are becoming very popular these days, not just because they save developers the trouble of managing the servers, but also because they provide several other benefits such as cutting heavy costs and improving the overall performance of the application. This book will help you build serverless applications in a quick and efficient way. We begin with an introduction to AWS and the API gateway, the environment for serverless development, and Zappa. We then look at building, testing, and deploying apps in AWS with three different frameworks--Flask, Django, and Pyramid. Setting up a custom domain along with SSL certificates and configuring them with Zappa is also covered. A few advanced Zappa settings are also covered along with securing Zappa with AWS VPC. By the end of the book you will have mastered using three frameworks to build robust and cost-efficient serverless apps in Python.
Table of Contents (20 chapters)
Title Page
Dedication
Packt Upsell
Contributors
Preface
Index

Basic uses


Zappa covers each and every deployment process. Let's have a detailed discussion regarding the deployment flow with Zappa.

Initial deployments

Once you are done with initializing Zappa, then you can deploy the application on to the production stage in a single command, as shown in the following code snippet:

$ zappa deploy production
.
.
.
Deployment complete ! https://071h4br4e0.execute-api.ap-south-1.amazonaws.com/production

When you call the $ zappa deploy command, Zappa performs some tasks to complete the deployment. The following is the internal flow and process of Zappa regarding deployment:

  1. Compress the application code in your local environment into a ZIP archive by replacing any dependencies with versions in a precompiled Lambda package.
  2. Set up the Lambda handler function with the required WSGI middleware based on your application's type.
  3. Upload the generated archive from the preceding two steps into the Amazon S3 bucket.
  4. Create and manage the necessary AWS IAM policies and roles...