-
Notifications
You must be signed in to change notification settings - Fork 9
/
serverless.yml
54 lines (52 loc) · 1.62 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
service: gptbot
provider:
name: aws
runtime: nodejs16.x
stage: ${opt:stage, 'dev'}
region: us-east-1
environment:
BOT_FUNCTION_NAME: ${self:service}-${self:provider.stage}-botFunction
DYNAMODB_TABLE: ${self:service}-${opt:stage, self:provider.stage}
SLACK_BOT_TOKEN: ${env:SLACK_BOT_TOKEN}
SLACK_SIGNING_SECRET: ${env:SLACK_SIGNING_SECRET}
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
- Effect: Allow
Action:
- lambda:InvokeFunction
- lambda:InvokeAsync
Resource: "arn:aws:lambda:${opt:region, self:provider.region}:*:function:${self:provider.environment.BOT_FUNCTION_NAME}"
functions:
acknowledgerFunction:
handler: dist/acknowledger.handler
provisionedConcurrency: 1
events:
- httpApi: 'POST /slack/events'
botFunction:
handler: dist/bot.handler
environment:
OPENAI_API_KEY: ${env:OPENAI_API_KEY}
timeout: 300
resources:
Resources:
conversationsTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:provider.environment.DYNAMODB_TABLE}
AttributeDefinitions:
- AttributeName: channel_id
AttributeType: S
KeySchema:
- AttributeName: channel_id
KeyType: HASH
BillingMode: PAY_PER_REQUEST