-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.ts
75 lines (71 loc) · 1.9 KB
/
serverless.ts
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
import type { AWS } from '@serverless/typescript'
import * as functions from '@functions/index'
// Resources
import Resources from './aws/Resources'
const serverlessConfiguration: AWS = {
service: 'iideass-be-dynamodb',
frameworkVersion: '3',
plugins: ['serverless-esbuild', 'serverless-offline'],
useDotenv: true,
provider: {
name: 'aws',
runtime: 'nodejs16.x',
apiGateway: {
minimumCompressionSize: 1024,
shouldStartNameWithService: true,
metrics: true,
},
environment: {
AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
NODE_OPTIONS: '--enable-source-maps --stack-trace-limit=1000',
NODE_ENV: process.env.NODE_ENV || 'production',
IDEAS_TABLE_NAME: process.env.IDEAS_TABLE_NAME || '${env:IDEAS_TABLE_NAME}',
},
iam: {
role: {
statements: [
{
Effect: 'Allow',
Action: [
'dynamodb:List*',
'dynamodb:BatchGet*',
'dynamodb:DescribeStream',
'dynamodb:DescribeTable',
'dynamodb:Get*',
'dynamodb:Query',
'dynamodb:Scan',
'dynamodb:BatchWrite*',
'dynamodb:CreateTable',
'dynamodb:Delete*',
'dynamodb:Update*',
'dynamodb:PutItem',
],
Resource: 'arn:aws:dynamodb:*:*:table/${env:IDEAS_TABLE_NAME}',
},
],
},
},
logs: {
httpApi: true,
},
logRetentionInDays: 30,
memorySize: 512,
},
// import the function via paths
package: { individually: true },
custom: {
esbuild: {
bundle: true,
minify: false,
sourcemap: true,
exclude: ['aws-sdk'],
target: 'node16',
define: { 'require.resolve': undefined },
platform: 'node',
concurrency: 10,
},
},
resources: { Resources },
functions,
}
module.exports = serverlessConfiguration