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

Building, testing, and deploying the Django application using Zappa


Zappa configuration is straightforward. The Zappa package is available in the pip repository as well. But we are going to install it with pipenv, which helps us to keep track of the version management. The following is the command you will need to install Zappa:

$ pipenv install zappa

After the Zappa installation, you will need to initialize Zappa with the command zappa init. This command will prompt a shell questioner to configure Zappa with the required, basic information. Let's have a look at the next section, where we will discuss Zappa's basic configuration.

 

 

 

 

 

 

Configuring Zappa

Once you are done with the zappa init command, Zappa creates a zappa_settings.json file. This file contains the configuration information, which is required to perform the deployment. The following is the code snippet of the zappa_settings.json file:

{
    "dev": {
        "aws_region": "ap-south-1",
        "django_settings": "imageGalleryProject...