-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserverless.yml
55 lines (52 loc) · 1.3 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
service: aws-node-project
plugins:
- serverless-plugin-typescript
- serverless-offline
provider:
websocketsApiName: websockets-api
websocketsApiRouteSelectionExpression: $request.body.action
name: aws
region: "ap-south-1"
runtime: nodejs12.x
lambdaHashingVersion: "20201221"
iam:
role:
statements: # permissions for all of your functions can be set here
- Effect: Allow
Action: # Gives permission to DynamoDB tables
- logs:*
- dynamodb:*
- states:*
- events:*
Resource:
- "*"
- "arn:aws:dynamodb:*:*:*"
functions:
OnConnectHandler:
handler: handler.onConnect
events:
- websocket:
route: $connect
OnDisconnect:
handler: handler.onDisconnect
events:
- websocket:
route: $disconnect
onBroadcast:
handler: handler.onBroadcast
events:
- websocket:
route: broadcast
resources:
Resources:
WebSocketTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: web-socket-connections
AttributeDefinitions:
- AttributeName: connectionId
AttributeType: S
KeySchema:
- AttributeName: connectionId
KeyType: HASH
BillingMode: PAY_PER_REQUEST