-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
68 lines (66 loc) · 1.93 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
58
59
60
61
62
63
64
65
66
67
68
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: AWS SAM for Moneyline
Resources:
# API Gateway
MoneylineAPI:
Type: AWS::Serverless::Api
Properties:
StageName: dev
Auth:
ApiKeyRequired: false
DefinitionBody:
swagger: 2.0
info:
title: moneyline-sam
x-amazon-apigateway-request-validators:
Validate body:
validateRequestBody: false
validateRequestParameters: false
x-amazon-apigateway-binary-media-types:
- '*/*'
definitions:
Empty:
type: "object"
title: "Empty Schema"
paths:
/predictions:
post:
x-amazon-apigateway-integration:
httpMethod: POST
type: aws_proxy
uri:
!Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MoneylineSamLambda.Arn}/invocations
responses:
"200":
description: "200 response"
schema:
$ref: "#/definitions/Empty"
headers:
Access-Control-Allow-Origin:
type: "string"
# Lambda
MoneylineSamLambda:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub MoneylineSamLambda
Runtime: python3.8
CodeUri: APIFunction/
Handler: lambda_function.lambda_handler
MemorySize: 128
Timeout: 180
Policies:
- AWSLambdaBasicExecutionRole
- AmazonDynamoDBFullAccess
Events:
MyEndpoint:
Type: Api
Properties:
Path: /predictions
Method: post
RestApiId:
Ref: MoneylineAPI
Outputs:
ApiGWURL:
Value: !Sub https://${MoneylineAPI}.execute-api.${AWS::Region}.amazonaws.com/dev/predictions
Description: API Gateway endpoint