-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
86 lines (86 loc) · 2.43 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
service: serverless-duckdb-bot
useDotenv: true
frameworkVersion: '3'
plugins:
- serverless-webpack
- serverless-iam-roles-per-function
- serverless-prune-plugin
- serverless-dotenv-plugin
custom:
#Webpack settings
webpack:
webpackConfig: 'webpack.config.js'
includeModules: false # Node modules configuration for packaging
packager: 'npm' # Packager that will be used to package your external modules
# Prune plugin
prune:
automatic: true
number: 1
provider:
name: aws
runtime: nodejs16.x
region: ${opt:region, 'us-east-1'}
stage: 'prd'
logRetentionInDays: 14
httpApi:
payload: '2.0'
cors: true
# apiGateway:
# apiKeys:
# - DuckDBKey
functions:
duckdb-query:
handler: query.handler
memorySize: 1024
timeout: 28
# iamRoleStatements:
# # Read from input bucket
# - Effect: Allow
# Action:
# - s3:GetObject
# Resource: 'arn:aws:s3:::YOUR-S3-INPUT-BUCKET-NAME/*'
# - Effect: Allow
# Action:
# - s3:ListBucket
# Resource: 'arn:aws:s3:::YOUR-S3-INPUT-BUCKET-NAME'
# # If you want to write to another output bucket, use the statements below
# # (or use the same bucket name as the input bucket if you want to write to it as well)
# - Effect: Allow
# Action:
# - s3:ListBucket
# - s3:ListBucketMultipartUploads
# Resource: 'arn:aws:s3:::YOUR-S3-OUTPUT-BUCKET-NAME'
# - Effect: Allow
# Action:
# - s3:GetObject
# - s3:PutObject
# - s3:AbortMultipartUpload
# - s3:ListMultipartUploadParts
# Resource: 'arn:aws:s3:::YOUR-S3-OUTPUT-BUCKET-NAME/*'
layers:
- 'arn:aws:lambda:${self:provider.region}:041475135427:layer:duckdb-nodejs-x86:3'
events:
- httpApi:
path: '/query'
method: post
discord-bot:
handler: index.handler
memorySize: 128
timeout: 29
iamRoleStatements:
# Invoke self (bot)
- Effect: Allow
Action:
- lambda:InvokeFunction
Resource: 'arn:aws:lambda:us-east-1:360797132652:function:serverless-duckdb-bot-prd-discord-bot'
# Invoke function that runs queries
- Effect: Allow
Action:
- lambda:InvokeFunction
Resource: 'arn:aws:lambda:us-east-1:360797132652:function:serverless-duckdb-bot-prd-duckdb-query'
events:
- httpApi:
path: '/event'
method: post
package:
individually: true