-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
98 lines (90 loc) · 2.12 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
service: market-node
frameworkVersion: "2"
useDotenv: true
plugins:
- serverless-webpack
- serverless-dynamodb-local
- serverless-offline
provider:
name: aws
runtime: nodejs12.x
region: ${env:AWS_REGION}
lambdaHashingVersion: "20201221"
apiGateway:
shouldStartNameWithService: true
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "*"
package:
individually: true
custom:
webpack:
webpackConfig: ./webpack.config.js
serverless-offline:
useChildProcesses: true
dynamodb:
start:
migrate: true
stages:
- local
functions:
admin:
handler: src/app/admin/app.handler
events:
- http:
path: /admin
method: ANY
cors: true
- http:
path: /admin/{proxy+}
method: ANY
cors: true
resources:
Resources:
ProductTable:
Type: "AWS::DynamoDB::Table"
DeletionPolicy: Retain
Properties:
TableName: product
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
BillingMode: PAY_PER_REQUEST
CategoryTable:
Type: "AWS::DynamoDB::Table"
DeletionPolicy: Retain
Properties:
TableName: category
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
BillingMode: PAY_PER_REQUEST
ProductCategoryTable:
Type: "AWS::DynamoDB::Table"
DeletionPolicy: Retain
Properties:
TableName: product-category
AttributeDefinitions:
- AttributeName: productId
AttributeType: S
- AttributeName: categoryId
AttributeType: S
KeySchema:
- AttributeName: productId
KeyType: HASH
- AttributeName: categoryId
KeyType: RANGE
BillingMode: PAY_PER_REQUEST