-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
68 lines (63 loc) · 1.83 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
66
67
68
service: aws-appsync-subscription
frameworkVersion: '3'
plugins:
- serverless-appsync-plugin
provider:
name: aws
runtime: nodejs14.x
region: ap-southeast-1
custom:
tableName: chatRoom
appSync:
- name: 'appsyncChatApp'
schema: schema.graphql
authenticationType: AWS_LAMBDA
lambdaAuthorizerConfig:
functionName: lambdaAuthorizer
# additionalAuthenticationProviders:
# - authenticationType: AWS_IAM
# - authenticationType: API_KEY
mappingTemplatesLocation: mapping-templates
mappingTemplates:
- dataSource: sendChat
type: Mutation
field: sendChat
request: "Mutation.sendChat.request.vtl"
response: "Mutation.sendChat.response.vtl"
- dataSource: ChatRoom
type: Query
field: getChatRoom
request: "Query.getChatRoom.request.vtl"
response: "Query.getChatRoom.response.vtl"
- dataSource: ChatRoom
type: Subscription
field: incomingChat
request: "Subscription.sendChat.request.vtl"
response: "Subscription.sendChat.response.vtl"
dataSources:
- type: AMAZON_DYNAMODB
name: ChatRoom
config:
tableName: ${self:custom.tableName}
resources:
Resources:
userTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.tableName}
AttributeDefinitions:
- AttributeName: pk
AttributeType: S
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: pk
KeyType: HASH
- AttributeName: id
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
functions:
lambdaAuthorizer:
handler: lambdaAuthorizer.handler