-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yml
53 lines (50 loc) · 1.28 KB
/
template.yml
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Resources:
ApiGateway:
Type: 'AWS::Serverless::Api'
Properties:
StageName: 'prod'
Auth:
# Disabling authorization
DefaultAuthorizer: NONE
AddDefaultAuthorizerToCorsPreflight: false
DynamoDbTable:
Type: 'AWS::Serverless::SimpleTable'
Properties:
TableName: SoilMoistureData
PrimaryKey:
Name: id
Type: String
LambdaWrite:
Type: 'AWS::Serverless::Function'
Properties:
Handler: 'write.handler'
Runtime: 'nodejs16.x'
CodeUri: functionWrite/
Events:
ApiGatewayEvent:
Type: 'Api'
Properties:
RestApiId: !Ref ApiGateway
Path: '/write'
Method: 'post'
Policies:
DynamoDBWritePolicy:
TableName: !Ref DynamoDbTable
LambdaRead:
Type: 'AWS::Serverless::Function'
Properties:
Handler: 'read.handler'
Runtime: 'nodejs16.x'
CodeUri: functionRead/
Events:
ApiGatewayEvent:
Type: 'Api'
Properties:
RestApiId: !Ref ApiGateway
Path: '/read'
Method: 'get'
Policies:
DynamoDBWritePolicy:
TableName: !Ref DynamoDbTable