Repository navigation
Expand file tree
/
Copy pathserverless.yml
More file actions
92 lines (82 loc) · 1.84 KB
/
Copy pathserverless.yml
File metadata and controls
92 lines (82 loc) · 1.84 KB
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
# serverless.yml
service: serverless-memory-game
provider:
name: aws
runtime: nodejs6.10
stage: dev
region: us-east-1
apiKeys:
- MemoryGameApiKey
usagePlan:
quota:
limit: 99999
offset: 2
period: MONTH
throttle:
burstLimit: 200
rateLimit: 100
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Scan
- dynamodb:PutItem
Resource:
- { "Fn::GetAtt": ["MemoryDynamoDBTable", "Arn" ] }
environment:
SCORES_TABLE: ${self:custom.tableName}
functions:
app:
handler: index.handler
events:
- http:
path: '/'
method: 'GET'
cors: true
#private: true
getScores:
handler: index.handler
events:
- http:
path: '/scores'
method: 'GET'
cors: true
#private: true
createScore:
handler: index.handler
events:
- http:
path: '/scores'
method: 'POST'
cors: true
#private: true
resources:
Resources:
MemoryDynamoDBTable:
Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
- AttributeName: type
AttributeType: S
- AttributeName: time
AttributeType: N
KeySchema:
- AttributeName: type
KeyType: HASH
- AttributeName: time
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:custom.tableName}
plugins:
- serverless-webpack
- serverless-dynamodb-local
- serverless-offline #serverless-offline needs to be last in the list
custom:
webpack: ./webpack.config.js
tableName: 'memory-game-${self:provider.stage}'
dynamodb:
start:
migrate: true
serverless-offline:
host: 0.0.0.0