Reduce time manually maintaining servers by using Zappa and Amazon Web Services (AWS) Lambda to deploy serverless Django apps.

Serverless architecture has been one of the hot points of discussion concerning software development and deployment in recent years. This tutorial explains the concept of implementing serverless architecture in a Django app using Zappa and Amazon Web Services (AWS) Lambda.

Zappa requirements

To follow along with this tutorial, Zappa assumes you have the following:

  • AWS Lambda IAM credentials (follow this guide)
  • Some experience with Django
  • A Python development environment with Pipenv and Django setup

What does it mean to go serverless?

To go serverless simply means that you no longer need to manually maintain your own servers. Instead, you subscribe to a platform such as AWS Lambda that manages the workaround infrastructure for you. A bit of a misnomer, being serverless does not mean there are no servers, but rather that the management of servers, operating systems, and other related infrastructure are handled for you.

AWS Lambda

AWS Lambda is a popular function as a service (FAAS) that helps you run and manage servers by doing virtually all the heavy-lifting for you. As a bonus, you only have to pay for the time your servers are actually in use.

Zappa

Zappa is a dev ops toolbox designed to help ease the workload developers face when deploying and managing serverless web applications compatible with the Web Server Gateway Interface (WSGI) on AWS Lambda and the AWS API Gateway. If you are familiar with using Laravel Vapor for managing Laravel applications, then you’ll notice that Zappa serves a similar function for Python web-based frameworks like Django and Flask.

While Zappa has many functions as a deployment tool, here are a few of its most notable advantages:

  • Package your projects into Lambda-ready zip files and upload them to Amazon S3
  • Set up necessary AWS IAM roles and permissions
  • Deploy your application to various stages (dev, staging, prod)
  • Automatically configure your project’s API Gateway routes, methods, and integration responses
  • Turn your project’s API Gateway requests into valid WSGI, and return API Gateway-compatible HTTP responses

Next, we will walk through how to set up Zappa and AWS Lambda in a Django app.

#django #python #web-development #aws #serverless

Using Zappa and AWS Lambda to Deploy Serverless Django Apps
2.50 GEEK