-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
75 lines (70 loc) · 1.69 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
service: bci4als
app: bci4als
org: tonythree
frameworkVersion: "2"
plugins:
- serverless-offline
- serverless-python-requirements
provider:
name: aws
runtime: python3.8
lambdaHashingVersion: 20201221
region: eu-west-1
stage: ${opt:stage, "staging"}
environment:
eventsTable: ${self:custom.eventsTableName}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
- { "Fn::GetAtt": ["eventsTable", "Arn"] }
- Fn::Join:
- "/"
- - { "Fn::GetAtt": ["eventsTable", "Arn"] }
- "index/*"
functions:
create_event:
handler: lambdas/create_event.handler
events:
- http:
path: /events
method: post
get_event:
handler: lambdas/get_event.handler
events:
- http:
path: /events/{id}
method: get
get_events_list:
handler: lambdas/get_events_list.handler
events:
- http:
path: /events
method: get
custom:
eventsTableName: ${self:service}-${self:provider.stage}
resources:
Resources:
eventsTable:
Type: "AWS::DynamoDB::Table"
Properties:
TableName: ${self:custom.eventsTableName}
AttributeDefinitions:
- AttributeName: pk
AttributeType: S
- AttributeName: sk
AttributeType: S
KeySchema:
- AttributeName: pk
KeyType: HASH
- AttributeName: sk
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1