-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
55 lines (51 loc) · 1.17 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:
name: websocket-chat
plugins:
- serverless-webpack
provider:
name: aws
stage: ${env:NODE_ENV, "development"}
region: ${env:AWS_REGION}
runtime: nodejs12.x
iamRoleStatements:
- Effect: "Allow"
Action:
- "dynamodb:PutItem"
- "dynamodb:DeleteItem"
- "dynamodb:Scan"
Resource:
- Fn::Join:
- ""
- - Fn::GetAtt: [ConnectionTable, Arn]
- "*"
functions:
connect:
handler: handler.connect
events:
- websocket:
route: $connect
disconnect:
handler: handler.disconnect
events:
- websocket:
route: $disconnect
broadcast:
handler: handler.broadcast
events:
- websocket:
route: $default
resources:
Resources:
ConnectionTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${env:CONNECTION_TABLE_NAME, "ConnectionIds"}
AttributeDefinitions:
- AttributeName: connectionId
AttributeType: S
KeySchema:
- AttributeName: connectionId
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5