-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
82 lines (76 loc) · 2.24 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
service: CryptocurrencyPortfolioAPI
provider:
name: aws
stage: ${opt:stage, 'dev'}
runtime: nodejs8.10
memorySize: 128
iamRoleStatements:
- Effect: "Allow"
Action:
- "dynamodb:UpdateItem"
- "dynamodb:PutItem"
- "dynamodb:UpdateItem"
- "dynamodb:GetItem"
- "dynamodb:Query"
Resource:
- "arn:aws:dynamodb:*:*:table/${self:resources.Resources.portfoliosTable.Properties.TableName}"
- "arn:aws:dynamodb:*:*:table/${self:resources.Resources.portfoliosTable.Properties.TableName}*"
functions:
createPortfolio:
handler: portfolioService.createPortfolio
events:
- http:
path: createPortfolio
method: post
environment:
stage: ${self:provider.stage}
table: ${self:resources.Resources.portfoliosTable.Properties.TableName}
editPortfolio:
handler: portfolioService.editPortfolio
events:
- http:
path: editPortfolio
method: post
environment:
stage: ${self:provider.stage}
table: ${self:resources.Resources.portfoliosTable.Properties.TableName}
getPortfolio:
handler: portfolioService.getPortfolio
events:
- http:
path: portfolio/{id}
method: get
request:
parameters:
paths:
id: true
environment:
stage: ${self:provider.stage}
table: ${self:resources.Resources.portfoliosTable.Properties.TableName}
resources:
Resources:
portfoliosTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: portfoliosTbl_${self:provider.stage}
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: identifier
AttributeType: S
- AttributeName: editSecretTokenHashed
AttributeType: S
KeySchema:
- AttributeName: identifier
KeyType: HASH
GlobalSecondaryIndexes:
- IndexName: EditToken
KeySchema:
- AttributeName: editSecretTokenHashed
KeyType: HASH
Projection:
ProjectionType: KEYS_ONLY
Outputs:
portfoliosTableArn:
Description: The ARN for the portfolio table
Value:
"Fn::GetAtt": [ portfoliosTable, Arn ]