-
Notifications
You must be signed in to change notification settings - Fork 4
/
template.yaml
57 lines (53 loc) · 1.37 KB
/
template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: AWS SAM template with API defined in an external Swagger file along with Lambda integrations and CORS configurations
Parameters:
SwaggerS3File:
Type: String
Description: The uploaded swagger.yaml
Resources:
ApiGatewayApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
Cors: "'*'"
DefinitionBody:
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Location: !Ref 'SwaggerS3File'
GetLambdaFunction:
Type: AWS::Serverless::Function
Properties:
Handler: function/index.get
Runtime: nodejs6.10
Events:
ProxyApiRoot:
Type: Api
Properties:
RestApiId: !Ref ApiGatewayApi
Path: /questions
Method: GET
PostLambdaFunction:
Type: AWS::Serverless::Function
Properties:
Handler: function/index.post
Runtime: nodejs6.10
Events:
ProxyApiRoot:
Type: Api
Properties:
RestApiId: !Ref ApiGatewayApi
Path: /questions
Method: POST
Outputs:
ApiUrl:
Description: URL of your API endpoint
Value: !Join
- ''
- - https://
- !Ref ApiGatewayApi
- '.execute-api.'
- !Ref 'AWS::Region'
- '.amazonaws.com/Prod'