-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
85 lines (80 loc) · 1.92 KB
/
serverless.yml
File metadata and controls
85 lines (80 loc) · 1.92 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
console: true
service: cripto-serverless
frameworkVersion: '3'
custom:
UPDATE_TIMER: 60 minutes
settings:
TABLE_NAME: Tokens
COINLAYER_KEY: 444de9717a5c7a18034dad8f532105d8
HISTORIC_LIMIT: 5
provider:
name: aws
runtime: nodejs12.x
stage: dev
region: us-east-1
environment: ${self:custom.settings}
iamRoleStatements:
- Effect: "Allow"
Action:
- dynamodb:DescribeTable
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:Query
- dynamodb:BatchWriteItem
Resource:
- "arn:aws:dynamodb:${self:provider.region}:*:table/${self:custom.settings.TABLE_NAME}"
functions:
hello:
handler: lambdas/hello.handler
events:
- httpApi:
path: /
method: GET
createToken:
handler: lambdas/createToken.handler
events:
- httpApi:
path: /tokens
method: POST
listToken:
handler: lambdas/listToken.handler
events:
- httpApi:
path: /tokens
method: GET
getToken:
handler: lambdas/getToken.handler
events:
- httpApi:
path: /tokens/{id}
method: GET
deleteToken:
handler: lambdas/deleteToken.handler
events:
- httpApi:
path: /tokens/{id}
method: DELETE
updateToken:
handler: lambdas/updateToken.handler
events:
- eventBridge:
enable: true
schedule: rate(${self:custom.UPDATE_TIMER})
resources:
Resources:
TokenTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.settings.TABLE_NAME}
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: "tokenId"
AttributeType: "S"
- AttributeName: "timestamp"
AttributeType: "N"
KeySchema:
- AttributeName: "tokenId"
KeyType: "HASH"
- AttributeName: "timestamp"
KeyType: "RANGE"