python rest api aws lambda code example
Example 1: creating rest api in serverless with python
1
2
3service: serverless-flask
4
5plugins:
6 - serverless-python-requirements
7 - serverless-wsgi
8
9custom:
10 wsgi:
11 app: app.app
12 packRequirements: false
13 pythonRequirements:
14 dockerizePip: non-linux
15
16provider:
17 name: aws
18 runtime: python3.6
19 stage: dev
20 region: us-east-1
21
22functions:
23 app:
24 handler: wsgi.handler
25 events:
26 - http: ANY /
27 - http: 'ANY {proxy+}'
Example 2: 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