-
Notifications
You must be signed in to change notification settings - Fork 11
/
serverless.yml
86 lines (73 loc) · 2.13 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:
name: ${file(./modules/sanitizeStackName.js):sanitize}
plugins:
- serverless-s3-sync
- serverless-pseudo-parameters
- serverless-stack-output
- serverless-cloudfront-invalidate
custom:
# The domain name to be used
domainName: ${opt:domain}
# API base path
basePath: 'v1'
# API endpoint type
endpointType: 'EDGE'
# API Gateway settings
apiGateway:
# See https://docs.aws.amazon.com/general/latest/gr/rande.html#apigateway_region
hostedZone: 'Z2FDTNDATAQYW2'
# Output plugin configuration
output:
handler: modules/output.handler
# CloudFront invalidation plugin configuration
cloudfrontInvalidate:
distributionIdKey: 'CloudFrontDistributionId'
items: # Add your files to invalidate here:
- '/index.html'
# S3 sync plugin configuration
s3Sync:
- bucketName: ${opt:domain}
localDir: website
provider:
name: aws
runtime: nodejs10.x
region: ${opt:region, 'us-east-1'}
# API Gateway settings
apiGateway:
restApiId: '#{ApiGatewayRestApi}'
restApiRootResourceId: '#{ApiGatewayRestApi.RootResourceId}'
functions:
api:
handler: api/baseApi.router
memorySize: 256
timeout: 5
environment:
AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1' # Enable HTTP keep-alive connections for the AWS SDK
DOMAIN_NAME: '${self:custom.domainName}'
BASE_PATH: '${self:custom.basePath}'
events:
- http:
path: '{proxy+}'
method: any
resources:
- ${file(resources/api-gw.yml)}
- ${file(resources/api-gw-basepath-mapping.yml)}
- ${file(resources/api-gw-domain-name.yml)}
- ${file(resources/custom-acm-certificate-lambda.yml)}
- ${file(resources/custom-acm-certificate-lambda-role.yml)}
- ${file(resources/cloudfront-origin-access-identity.yml)}
- ${file(resources/s3-bucket.yml)}
- ${file(resources/s3-policies.yml)}
- ${file(resources/hosted-zone.yml)}
- ${file(resources/dns-records.yml)}
- ${file(resources/certificate.yml)}
- ${file(resources/cf-distribution.yml)}
- ${file(resources/outputs.yml)}
package:
exclude:
- docs/**
- modules/**
- resources/**
- website/**
- LICENSE
- README.md