-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
84 lines (71 loc) · 1.86 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
service: aws-api
frameworkVersion: '2'
package:
exclude:
- node_modules/**
- venv/**
provider:
name: aws
runtime: python3.8
lambdaHashingVersion: 20201221
iam:
role:
statements:
- Effect: "Allow"
Action:
- dynamodb:*
Resource: "*"
functions:
# Handler endpoints, self-explanatory
create:
handler: aws-api/handler.create
events:
- http:
path: events/create
method: post
get_by_status:
handler: aws-api/handler.get_by_status
events:
- http:
path: events/{status_param}
method: get
resources:
Resources:
eventsTable:
# DynamoDB Schema and our data structure
Type: AWS::DynamoDB::Table
Properties:
TableName: events
AttributeDefinitions:
- AttributeName: event_id
AttributeType: N
- AttributeName: status
AttributeType: S
- AttributeName: end_date
AttributeType: S
- AttributeName: timestamp
AttributeType: N
KeySchema:
- AttributeName: event_id
KeyType: HASH
GlobalSecondaryIndexes:
- IndexName: statusTimestampIndex
KeySchema:
- AttributeName: status
KeyType: HASH
- AttributeName: timestamp
KeyType: RANGE
Projection:
ProjectionType: 'ALL'
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
plugins:
- serverless-python-requirements
custom:
# Python is used in a dockerized environment when on non linux environments
pythonRequirements:
dockerizePip: non-linux