-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yaml
66 lines (60 loc) · 1.57 KB
/
serverless.yaml
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
org: aykutyaman
app: serverless
service: serverless
custom:
tableName: 'todos1-table-${sls:stage}'
provider:
name: aws
runtime: nodejs12.x
lambdaHashingVersion: '20201221'
region: eu-central-1
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
- Fn::GetAtt: [ TodosTable, Arn ]
environment:
TODOS_TABLE: ${self:custom.tableName}
plugins:
- serverless-offline
- serverless-plugin-typescript
functions:
api:
handler: server/handler.hello
events:
- httpApi: '*'
resources:
Resources:
TodosTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
-
AttributeName: pk
AttributeType: S
-
AttributeName: sk
AttributeType: S
KeySchema:
-
AttributeName: pk
KeyType: HASH
-
AttributeName: sk
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:custom.tableName}
#GlobalSecondaryIndexes
#https://github.com/serverless-examples/todo-serverless/blob/master/aws/serverless.yml
#https://github.com/serverless/examples/blob/cf08befc3925b8558229af1a987d05a2aadbf8ff/aws-dotnet-rest-api-with-dynamodb/src/DotNetServerless.Lambda/serverless.yml