Reputation: 6159
I want to deploy my Flask application to AWS Lambda. I tried deploying it using aws-cli, but it wasn't successful. How can I deploy Flask to Lambda?
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/status', methods = ['GET','POST'])
def service_run():
return "service is running"
Upvotes: 0
Views: 1556
Reputation: 1658
You can host the flask app on AWS using Elastic Beanstalk service of AWS instead of trying to use AWS Lambda. By doing it this way, your app would get hosted on a public URL so that you can access it anytime. This is the quickest way to launch a flask app on AWS.
For more details on how to host a flask application on AWS, refer the below link:
Hosting a flask app on AWS Elastic Beanstalk
Upvotes: 0
Reputation: 10305
You can deploy a Flask WSGI application to AWS Lambda using Zappa. Install zappa
and configure it:
pip install zappa
zappa init
Then deploy it with:
zappa deploy
Upvotes: 1