Maintaining the backends or servers is always a part of the headache for the programer. And here walk in the solution, serverless Architectures.
It refer to applications that significantly depend on third-party services (known as Backend as a Service or “BaaS”) or on custom code that’s run in ephemeral containers (Function as a Service or “FaaS”), the best known vendor host of which currently is AWS Lambda
Using an amazing library called Zappa, it is now easy to deploy in AWS Lambda.
Zappa is a system for running “serverless” Python web applications using AWS Lambda and AWS API Gateway. It handles all of the configuration and deployment automatically . Now it is easy to deploy an infinitely scalable application to the cloud with a just single command at the least possible cost often just a small fraction of the cost of a traditional web server.
You can install zappa easily using
pip install zappa
pip install --dev awscli
So before we start using Zappa, let’s create a simple hello world website using flask and run it on our locla server
At a directory of your choice, save the following program as Prg.py
app = Flask(__name__)
return "Hello world! ", 200
# We only need this
for local development.
And run it on your local server using the following commands at your cmd
Before we get our hands on some zappa, we need to ensure we have a valid AWS account.
You can create a AWS account by following the steps one by one here.
After creating an account, run the following command to configure your AWS account in your command line and and fill in the access key id, the secret access key and the default region..
Let’s configure Zappa now.
Run the follwing command in your project directory
This creates a file named
zappa_settings.json inside our project directory with the following content.
Now deploy zappa using
And it’s done!!Thtat’s all it takes.!Just a single command!
To learn more of zappa, which I am sure you would want to, check out these sites: