flask app in lambda code example
Example 1: creating rest api in serverless with python
1$ sls deploy
2... snip ...
3Service Information
4service: serverless-flask
5stage: dev
6region: us-east-1
7stack: serverless-flask-dev
8api keys:
9 None
10endpoints:
11 ANY - https://bl4r0gjjv5.execute-api.us-east-1.amazonaws.com/dev
12 ANY - https://bl4r0gjjv5.execute-api.us-east-1.amazonaws.com/dev/{proxy+}
13functions:
14 app: serverless-flask-dev-app
Example 2: Deploy Python Application on AWS Lambda
# serverless.ymlservice: serverless-flask# These are the plugins you have installed to support WSGI and pip # requirementsplugins: - serverless-python-requirements - serverless-wsgicustom: wsgi: # This is the file name and the app name of the application # Where file name is app.py and Flask app name is app # ie. app = Flask(__name__) app: app.app packRequirements: false pythonRequirements: dockerizePip: non-linuxprovider: name: aws runtime: python3.6 stage: dev region: us-east-1functions: app: handler: wsgi.handler events: - http: ANY / - http: 'ANY {proxy+}'