-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
Copy pathserverless.yml
68 lines (61 loc) · 1.46 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
service: serverless-ruby-sqs-dynamodb
frameworkVersion: '2'
provider:
name: aws
runtime: ruby2.7
memorySize: 256
lambdaHashingVersion: 20201221
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:PutItem
Resource:
- !GetAtt Table.Arn
constructs:
lotteryQueue:
type: queue
worker:
handler: src/handlers/lottery/worker.run
environment:
TABLE_NAME: ${self:custom.tableName}
alarm: ${self:custom.alertEmail}
batchSize: 5
functions:
createLotteryCoupon:
handler: src/handlers/lottery/handler.run
events:
- http:
method: post
path: lottery
environment:
QUEUE_URL: ${construct:lotteryQueue.queueUrl}
plugins:
- serverless-ruby-layer
- serverless-lift
custom:
tableName: ${self:service}-${sls:stage}
rubyLayer:
include_functions:
- createLotteryCoupon
- lotteryQueueWorker
alertEmail: mail@example.com
resources:
Resources:
Table:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.tableName}
Tags:
- Key: Application
Value: ${self:service}
- Key: Stage
Value: ${sls:stage}
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH