This repository has been archived by the owner on Oct 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
77 lines (69 loc) · 1.6 KB
/
serverless.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
service: contactotron
provider:
name: aws
runtime: nodejs8.10
profile: contactotron-admin
environment:
CONTACT_TOPIC_ARN:
Ref: contactotronTopic
CONTACT_TABLE_NAME:
Ref: contactotronMessagesTable
iamRoleStatements:
- Effect: 'Allow'
Action:
- "sns:Publish"
Resource:
- Ref: contactotronTopic
- Effect: 'Allow'
Action:
- "dynamodb:PutItem"
Resource:
Fn::GetAtt:
- contactotronMessagesTable
- Arn
package:
exclude:
- node_modules/**
# include:
functions:
submitContactForm:
handler: handler.submitContactForm
events:
- http:
path: submitContactForm
method: post
cors: true
saveContactMessage:
handler: handler.saveContactMessage
events:
- sns:
arn:
Ref: contactotronTopic
topicName: contactotronTopic-${self:provider.stage}
plugins:
- serverless-finch
custom:
client:
bucketName: robin-contactotron-lab-demo-2019
distributionFolder: build/
resources:
Resources:
contactotronTopic:
Type: AWS::SNS::Topic
Properties:
DisplayName: "Contactotron Contact Form"
TopicName: contactotronTopic-${self:provider.stage}
contactotronMessagesTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
-
AttributeName: id
AttributeType: S
KeySchema:
-
AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1