Passionate web developer
Serverless is one of the new buzz word right now, what does it really means? Serverless computing allows us to focus on building the application without managing infrastructure and scaling. Serverless doesn’t mean no servers at all. It is still there, but we are not going to manage it. The best part is that you only pay for the amount of resources each request consumed. Each request to the serverless function is allocated and the application code runs in a stateless container.
* Horizontally scalable
* Pay for what you use
* Infrastructure managed by service provider
AWS provides serverless service called "Lambda" which can be used to deploy and run serverless applications. AWS lambda lets us run any Python WSGI based applications on cloud. It To make this tutorial easier, we are going to use an popular open source serverless framework called "Zappa" and run "Flask" application on aws lambda.
* experience on AWS
* python 3
pip3 install Flask zappa
Create an user in IAM with administrative access and create api key and password. You will need this when you create zappa project.
from flask import Flask
app = Flask(__name__)
return "Hello World!"
Enter all required details in the interactive prompt, finally zappa_settings.json will look like this,
“profile_name”: “<aws_profile>”, // profile config at ~/.aws/credentials
zappa deploy dev
Zappa deploy process will automatically generate an web accessible url of the flask application.
When you update your flask application code, zappa has a command to update aws lambda deployment.
zappa update dev
if you enjoyed this article, feel free to hit that clap button 👏 to help others find it.
Create your free account to unlock your custom reading experience.