-
Notifications
You must be signed in to change notification settings - Fork 2
/
serverless.cdn.yml
83 lines (76 loc) · 2.4 KB
/
serverless.cdn.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
service: estate-id-api-cdn
frameworkVersion: '2'
provider:
name: aws
lambdaHashingVersion: 20201221
stage: dev
region: ap-northeast-1
custom:
stage: ${opt:stage, self:provider.stage}
commentStackLabel: '[cf:${self:service}-${self:custom.stage}]'
LogBucketNamePrefix: etate-id-distribution-logs-${self:custom.stage}
resources:
Outputs:
BackendCDNEndpoint:
Value:
Fn::Join:
- ''
- - 'https://'
- Fn::GetAtt: [ BackendCDNDistribution, DomainName ]
- '/v1'
FrontendDistributionLogBucket:
Value:
Fn::GetAtt: [ FrontendDistributionLogBucket, DomainName ]
BackendDistributionLogBucket:
Value:
Fn::GetAtt: [ BackendDistributionLogBucket, DomainName ]
Resources:
BackendCDNDistribution:
Type: AWS::CloudFront::Distribution
DependsOn:
- BackendDistributionLogBucket
Properties:
DistributionConfig:
Origins:
- Id: ipc-verification-api
DomainName: ${env:INCREMENTP_VERIFICATION_API_HOST}
CustomOriginConfig:
HTTPSPort: 443
OriginProtocolPolicy: "https-only"
OriginReadTimeout: 30
OriginKeepaliveTimeout: 5
# --- End Origins ---
DefaultCacheBehavior:
TargetOriginId: ipc-verification-api
ForwardedValues:
QueryString: true
Cookies:
Forward: none
Headers:
- 'x-api-key'
QueryStringCacheKeys:
- 'geocode'
MinTTL: 86400
DefaultTTL: 86400
MaxTTL: 86400
ViewerProtocolPolicy: redirect-to-https
# --- END DefaultCacheBehavior ---
Comment:
Fn::Join:
- ''
- - ${self:custom.commentStackLabel}
- 'Estate ID Backend CDN to cache ipc request.'
Enabled: true
Logging:
Bucket: !GetAtt BackendDistributionLogBucket.DomainName
IncludeCookies: false
FrontendDistributionLogBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.LogBucketNamePrefix}-frontend
AccessControl: Private
BackendDistributionLogBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.LogBucketNamePrefix}-backend
AccessControl: Private