-
Notifications
You must be signed in to change notification settings - Fork 2
/
serverless.yml
126 lines (118 loc) · 2.92 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
org: femioladeji
useDotenv: true
app: slack-wordsgame
service: slack-wordsgame
plugins:
- serverless-dotenv-plugin
- serverless-dynamodb-local
- serverless-offline
# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=X.X.X"
resources:
Resources:
slackAuth:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${env:SLACK_AUTH_TABLE}
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
gamesTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${env:DYNAMO_TABLE_NAME}
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
gameQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: ${env:SQS_QUEUE_NAME}
DelaySeconds: 60
MessageRetentionPeriod: 120
provider:
name: aws
runtime: nodejs18.x
region: us-west-2
versionFunctions: false
iamRoleStatements: # permissions for all of your functions can be set here
- Effect: Allow
Action: # Gives permission to DynamoDB tables in a specific region
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: ${env:DYNAMO_DB}
- Effect: Allow
Action: # Gives permission to DynamoDB tables in a specific region
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: ${env:SLACK_AUTH_DYNAMO_DB}
- Effect: Allow
Action:
- lambda:InvokeFunction
Resource: ${env:LAMBDA_ARN}
- Effect: Allow
Action:
- sqs:SendMessage
- sqs:ReceiveMessage
- sqs:DeleteMessage
- sqs:GetQueueAttributes
Resource: ${env:SQS_QUEUE_ARN}
functions:
game:
handler: game.start
name: start_game
timeout: 5
events:
- http:
path: game
method: post
end:
handler: game.end
name: end_game
timeout: 20
events:
- sqs: ${env:SQS_QUEUE_ARN}
slack-auth:
handler: slack.auth
name: slack-auth
timeout: 10
events:
- http:
path: slack-auth
method: post
cors: true
custom:
dynamodb:
stages:
- dev
start:
port: 8000
inMemory: true
heapInitial: 200m
heapMax: 1g
migrate: true
seed: true
convertEmptyValues: true