-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
113 lines (107 loc) · 2.64 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
service: congresschanges
app: congresschanges
org: alexlitel
package:
individually: true
plugins:
- serverless-offline
- serverless-webpack
- serverless-offline-sns
- serverless-s3-local
- serverless-pseudo-parameters
custom:
serverless-offline:
port: 3000
serverless-offline-sns:
port: 3001
serverless-s3-local:
port: 3002
directory: /tmp
webpack:
webpackConfig: ./webpack.config.js
provider:
name: aws
runtime: nodejs18.x
region: us-west-2
memorySize: 512
environment:
BUCKET:
Ref: changeBucket
CHANGE_SNS:
Ref: listChangesTopic
UPDATE_SNS:
Ref: usersUpdatedTopic
CONSUMER_API_KEY: ${param:CONSUMER_API_KEY}
CONSUMER_API_SECRET: ${param:CONSUMER_API_SECRET}
BOT_ACCESS_TOKEN: ${param:BOT_ACCESS_TOKEN}
BOT_ACCESS_TOKEN_SECRET: ${param:BOT_ACCESS_TOKEN_SECRET}
LIST_ACCESS_TOKEN: ${param:LIST_ACCESS_TOKEN}
LIST_ACCESS_TOKEN_SECRET: ${param:LIST_ACCESS_TOKEN_SECRET}
LIST_ID: ${param:LIST_ID}
NODE_ENV: production
iamRoleStatements:
- Effect: Allow
Action:
- s3:GetObject
- s3:PutObject
Resource:
Fn::Join:
- ''
- - 'arn:aws:s3:::'
- Ref: changeBucket
- '/*'
- Effect: Allow
Action:
- sns:Publish
- sns:Receive
Resource:
- arn:aws:sns:${aws:region}:${aws:accountId}:usersUpdated
- arn:aws:sns:${aws:region}:${aws:accountId}:listChanges
resources:
Resources:
changeBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: congresschanges
listChangesTopic:
Type: AWS::SNS::Topic
Properties:
DisplayName: listChanges
TopicName: listChanges
usersUpdatedTopic:
Type: AWS::SNS::Topic
Properties:
DisplayName: usersUpdated
TopicName: usersUpdated
functions:
updateData:
handler: src/handlers/updateData.handler
events:
- sns:
arn: !Ref usersUpdatedTopic
topicName: usersUpdated
apiEndpoint:
handler: src/handlers/apiEndpoint.handler
events:
- http:
path: update
method: post
cors: true
checkList:
handler: src/handlers/checkList.handler
events:
- schedule:
rate: rate(10 minutes)
enabled: true
layers:
- arn:aws:lambda:${aws:region}:${aws:accountId}:layer:canvas-nodejs:1
tweetChanges:
handler: src/handlers/tweetChanges.handler
timeout: 250
reservedConcurrency: 1
events:
- sns:
arn: !Ref listChangesTopic
topicName: listChanges
layers:
- arn:aws:lambda:${aws:region}:${aws:accountId}:layer:canvas-nodejs:1