-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
80 lines (77 loc) · 1.73 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
service: serverless-fanout-fanin
provider:
name: aws
runtime: python3.7
memorySize: 128
timeout: 10
region: eu-west-1
stage: ${opt:stage, 'dev'}
environment:
FAN_OUT_QUEUE_URL:
Ref: FanOutQueue
FAN_IN_TABLE:
Ref: FanInTable
NUMBER_OF_WORKER_ITEMS: 25
iamRoleStatements:
- Effect: Allow
Action:
- sqs:ReceiveMessage
- sqs:DeleteMessage
- sqs:GetQueueAttributes
- sqs:SendMessage
Resource:
Fn::GetAtt: FanOutQueue.Arn
- Effect: Allow
Action:
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:Query
- dynamodb:GetItem
Resource:
Fn::GetAtt: FanInTable.Arn
package:
exclude:
- '**/*'
include:
- 'handler.py'
functions:
ventilator:
handler: handler.ventilator
worker:
handler: handler.worker
timeout: 300
events:
- sqs:
arn:
Fn::GetAtt: FanOutQueue.Arn
batchSize: 10
sink:
handler: handler.sink
events:
- stream:
type: dynamodb
arn:
Fn::GetAtt: FanInTable.StreamArn
batchSize: 100
resources:
Resources:
FanOutQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: ${self:service}-queue
FanInTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:service}-table
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: key
AttributeType: S
KeySchema:
- AttributeName: key
KeyType: HASH
StreamSpecification:
StreamViewType: NEW_AND_OLD_IMAGES
TimeToLiveSpecification:
AttributeName: ttl
Enabled: true