Created
June 22, 2020 04:32
-
-
Save Leonti/f14c20da49113df3630ee42d1ff8010d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
S3BucketWWW: | |
Type: "AWS::S3::Bucket" | |
Properties: | |
BucketName: !Sub '${AWS::StackName}-www-redirect' | |
AccessControl: PublicRead | |
WebsiteConfiguration: | |
RedirectAllRequestsTo: | |
HostName: !Sub ${DomainName} | |
Protocol: https | |
CloudFrontDistributionRedirect: | |
Type: AWS::CloudFront::Distribution | |
Properties: | |
DistributionConfig: | |
Origins: | |
- DomainName: !Sub '${AWS::StackName}-www-redirect.s3-website-${AWS::Region}.amazonaws.com' | |
Id: !Sub 'S3-${AWS::StackName}-www-redirect' | |
CustomOriginConfig: | |
OriginProtocolPolicy: http-only | |
Enabled: true | |
HttpVersion: http2 | |
IPV6Enabled: true | |
Logging: | |
Bucket: !GetAtt S3BucketLogs.DomainName | |
IncludeCookies: false | |
Prefix: 'cdn-redirects/' | |
Aliases: | |
- !Sub 'www.${DomainName}' | |
DefaultCacheBehavior: | |
AllowedMethods: | |
- GET | |
- HEAD | |
CachedMethods: | |
- GET | |
- HEAD | |
TargetOriginId: !Sub 'S3-${AWS::StackName}-www-redirect' | |
Compress: True | |
DefaultTTL: 604800 | |
ForwardedValues: | |
QueryString: 'false' | |
Cookies: | |
Forward: none | |
ViewerProtocolPolicy: redirect-to-https | |
PriceClass: PriceClass_All | |
ViewerCertificate: | |
AcmCertificateArn: !Ref CertificateManagerCertificate | |
SslSupportMethod: sni-only |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment