-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
63 lines (59 loc) · 1.98 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
# "org" ensures this Service is used with the correct Serverless Framework Access Key.
org: toothlessdev
# "app" enables Serverless Framework Dashboard features and sharing them with other Services.
app: knud-2024
# "service" is the name of this project. This will also be added to your AWS resource names.
service: knud2024-server
stages:
default:
params:
tableName: "GuestBookTableV2"
provider:
name: aws
runtime: nodejs20.x
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
- Fn::GetAtt: ["GuestBookTable", Arn]
environment:
GUESTBOOK_TABLE: ${param:tableName}
functions:
api:
handler: handler.handler
events:
- httpApi: "*"
resources:
Resources:
GuestBookTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: PK
AttributeType: S
- AttributeName: SK
AttributeType: S
- AttributeName: id
AttributeType: S # GSI를 위한 정의
KeySchema:
- AttributeName: PK
KeyType: HASH
- AttributeName: SK
KeyType: RANGE
GlobalSecondaryIndexes:
- IndexName: IdIndex
KeySchema:
- AttributeName: id
KeyType: HASH
Projection:
ProjectionType: ALL
BillingMode: PAY_PER_REQUEST
TableName: ${param:tableName}