-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
77 lines (72 loc) · 2.32 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
service: ${self:custom.serverlessEnv.APP_NAME}
provider:
name: aws
runtime: nodejs12.x
stage: ${self:custom.serverlessEnv.STAGE}
region: ${self:custom.serverlessEnv.REGION}
environment:
STAGE: ${self:custom.serverlessEnv.STAGE}
iamRoleStatements:
- Effect: 'Allow'
Action:
- 'lambda:InvokeFunction'
Resource: "*"
functions:
nuxt:
handler: index.handler
events:
- http: ANY /
- http: ANY /{proxy+}
warmup:
enabled:
- prod
# warmup관련 설정 참고
# https://www.serverless.com/blog/keep-your-lambdas-warm
# https://github.com/FidelLimited/serverless-plugin-warmup#options
resources:
Resources:
CloudFrontDistribution:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
Aliases:
- ${self:custom.serverlessEnv.DOMAIN}
ViewerCertificate:
SslSupportMethod: sni-only
AcmCertificateArn: arn:aws:acm:us-east-1:592854792012:certificate/048a6320-e34b-43b7-8102-dd3b69fd29ba
Comment: nos-frontend CloudFront Distribution
DefaultCacheBehavior:
TargetOriginId: nosFrontendOrigin-${self:custom.serverlessEnv.STAGE}
ViewerProtocolPolicy: 'redirect-to-https'
DefaultTTL: 30
ForwardedValues:
# cloudfront에서 request header의 cookie중 어떤걸 오리진으로 넘겨줄지 설정하는 부분.
Cookies:
Forward: whitelist
WhitelistedNames:
- nos_jwt
- nos_history_month
QueryString: false
Enabled: true
Origins:
- Id: nosFrontendOrigin-${self:custom.serverlessEnv.STAGE}
DomainName:
Fn::Join:
- "."
- - Ref: ApiGatewayRestApi
- execute-api.${self:custom.serverlessEnv.REGION}.amazonaws.com
OriginPath: /${self:custom.serverlessEnv.STAGE}
CustomOriginConfig:
HTTPPort: 80
HTTPSPort: 443
OriginProtocolPolicy: https-only
plugins:
- serverless-apigw-binary
- serverless-plugin-warmup
custom:
serverlessEnv: ${file(./config/serverless-env-loader.js)}
warmup:
prewarm: true
apigwBinary:
types:
- '*/*'