forked from willfarrell/serverless-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
107 lines (98 loc) · 2.75 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
service: template
custom:
config: "${file(./serverless.config.json)}"
environment: "${file(./serverless.env.json)}"
authorizer:
name: authorizer
resultTtlInSeconds: 0
cors:
origin: '*'
headers:
- Authorization
- Content-Type
- X-Amz-Date
- X-Amz-Security-Token
- X-Amz-User-Agent
- X-Api-Key
allowCredentials: false
contentEncoding:
contentCompression: 1400
apiGatewayCaching:
enabled: true
clusterSize: '0.5' # 1.6, 6.1
dataEncrypted: true
ttlInSeconds: 3600
perKeyInvalidation:
requireAuthorization: true
handleUnauthorizedRequests: Ignore
#warmup:
# schedule: 'cron(0/5 8-17 ? * MON-FRI *)'
# timeout: 5
# prewarm: true
provider:
name: aws
runtime: nodejs8.10
versionFunctions: false
region: "ca-central-1"
environment: "${self:custom.environment}" # TODO move to each function to prevent cross env leakage
endpointType: REGIONAL
# Required for RDS Access
vpc:
securityGroupIds: "${self:custom.config.VPC_SECURITY_GROUP_IDS}"
subnetIds: "${self:custom.config.VPC_SUBNET_IDS}"
#iamRoleStatements:
# Massive hack to prevent `EMFILE: too many open files, scandir`
package:
individually: false
excludeDevDependencies: true
exclude:
- ./**
include:
- package.json
- node_modules/**
- '!node_modules/@commitlint/**'
- '!node_modules/husky/**'
- '!node_modules/lint-staged/**'
- '!node_modules/mocha/**'
- '!node_modules/prettier-standard-cli/**'
- '!node_modules/serverless/**'
- '!node_modules/serverless-*/**'
- '!node_modules/sinon/**'
- '!node_modules/standard-version/**'
- src/**
functions:
# authorizer:
# handler: src/handlers/authorizer-auth0.handler
# description: Authorize API requests
#environmentVariables:
# AUTH0_CLIENT_ID: ${self.custom.environment.AUTH0_CLIENT_ID}
# AUTH0_CLIENT_SECRET: ${self.custom.environment.AUTH0_CLIENT_SECRET}
health:
description: Used for health checks
memorySize: 128
timeout: 30
handler: src/handlers/health.handler
events:
- http:
path: health
method: GET
cors: ${self:custom.cors}
caching:
enabled: true
ttlInSeconds: 300
test-cache:
description: test endpoint to verify caching is working
test-compression:
description: test endpoint to verify compression is working
plugins:
- serverless-nested-stack
- serverless-pseudo-parameters
- serverless-plugin-tracing # X-Ray
#- serverless-domain-manager
- serverless-api-compression
- serverless-api-gateway-caching
#- serverless-plugin-warmup # if needed
- serverless-plugin-existing-s3
- serverless-mocha-plugin
- serverless-offline
- serverless-offline-scheduler