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
1 | pip install zappa |
1 | 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | from flask import Flask app = Flask(__name__) @app.route('/') def index(): return "Hello world! ", 200 # We only need this for local development. if __name__ == '__main__': app.run() |
And run it on your local server using the following commands at your cmd
1 2 3 | export FLASK_APP=Prg.py flask run |
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..
1 | aws configure |
Let’s configure Zappa now.
Run the follwing command in your project directory
1 | zappa init |
This creates a file named zappa_settings.json
inside our project directory with the following content.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | { "dev": { "app_function": "Prg.app", "s3_bucket": "zappa-some-random-id", "runtime": "python3.6" } } |
Now deploy zappa using
1 | zappa deploy |
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:
Tensorflow considered one of most used Machine Learning library offered by Google. It is fast, flexible and easy for beginners as well as professionals. Below is the list of free Tensorflow ebooks with their download link curated from different sources. Hope, you will find them useful in preparing for Tensorflow.
If you would like to list your ebook free of cost or would like to contribute, do comment or reach out to us.
Below is a list of free Machine Learning Ebooks with their download link curated from different sources. There are in different formats like mobi, epub and pdf. In case, you don’t have mobi or epub reader please download it separately to view those files. I expect you must be having pdf viewer. Below mentioned books are not only associated with specific language or profile. Hope, you will find them useful in preparing for Machine Learning.
If you would like to list your ebook free of cost or would like to contribute, do comment or reach out to us.
Did you check Free TensorFlow ebooks? Click on the link below: