-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
65 lines (60 loc) · 1.5 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
service: serverless-workshop-codecon
frameworkVersion: '3'
plugins:
- serverless-plugin-typescript
- serverless-dynamodb-local
- serverless-offline
custom:
dynamodb:
stages:
- local-dev
start:
port: 8000
inMemory: true
heapInitial: 200m
heapMax: 1g
migrate: true
seed: true
convertEmptyValues: true
provider:
name: aws
runtime: nodejs16.x
environment:
SERVERLESS_WORKSHOP_TABLE: ${self:service}-serverless-workshop-${sls:stage}
iam:
role:
statements:
- Effect: 'Allow'
Action:
- 'dynamodb:PutItem'
- 'dynamodb:Get*'
- 'dynamodb:Scan*'
- 'dynamodb:UpdateItem'
- 'dynamodb:DeleteItem'
Resource: arn:aws:dynamodb:${aws:region}:${aws:accountId}:table/${self:service}-serverless-workshop-${sls:stage}
functions:
create:
handler: src/controllers/Create.handler
events:
- httpApi:
path: /create
method: post
redirect:
handler: src/controllers/Redirect.handler
events:
- httpApi:
path: /{linkId}
method: get
resources:
Resources:
ServerlessWorkshopTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: linkId
AttributeType: S
BillingMode: PAY_PER_REQUEST
KeySchema:
- AttributeName: linkId
KeyType: HASH
TableName: ${self:service}-serverless-workshop-${sls:stage}