forked from DefiLlama/peggedassets-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi-cloudfront-distribution.yml
67 lines (67 loc) · 1.86 KB
/
api-cloudfront-distribution.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
Resources:
ApiCloudfront:
Type: AWS::CloudFront::Distribution
DependsOn:
- ApiGatewayRestApi
Properties:
DistributionConfig:
Origins:
- Id: ApiGateway
DomainName:
Fn::Join:
- ""
- - Ref: ApiGatewayRestApi
- ".execute-api."
- Ref: AWS::Region
- ".amazonaws.com"
CustomOriginConfig:
HTTPPort: 80
HTTPSPort: 443
OriginProtocolPolicy: https-only
OriginSSLProtocols: [ "TLSv1.2" ]
OriginPath: /${self:custom.stage}
Enabled: true
HttpVersion: http2
Comment: CDN for API Gateway (${self:custom.stage})
Aliases:
- ${self:custom.domain}
PriceClass: PriceClass_All
DefaultCacheBehavior:
AllowedMethods:
- DELETE
- GET
- HEAD
- OPTIONS
- PATCH
- POST
- PUT
CachedMethods:
- HEAD
- GET
- OPTIONS
MinTTL: 0
ForwardedValues:
QueryString: 'true'
Cookies:
Forward: none
DefaultTTL: 0
TargetOriginId: ApiGateway
ViewerProtocolPolicy: redirect-to-https
CustomErrorResponses: []
ViewerCertificate:
AcmCertificateArn: ${self:custom.certificateArn}
SslSupportMethod: sni-only
ApiDNSName:
Type: AWS::Route53::RecordSetGroup
Properties:
HostedZoneName: ${self:custom.hostedZone}.
RecordSets:
- Name: ${self:custom.domain}
Type: A
AliasTarget:
HostedZoneId: Z2FDTNDATAQYW2
DNSName: !GetAtt [ApiCloudfront, DomainName]
Outputs:
ApiCloudfrontDistribution:
Value: !Ref 'ApiCloudfront'
Description: Id of Cloudfront distribution that fronts the API