buckrogers/scripts/cfn/buckrogers.yaml
2021-12-29 14:35:55 -08:00

87 lines
3.0 KiB
YAML

AWSTemplateFormatVersion: "2010-09-09"
Description: "Buck Rogers: Countdown to Doomsday static site"
Resources:
BuckRogersSiteBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: "buckrogerscountdowntodoomsday.com"
PublicAccessBlockConfiguration:
BlockPublicAcls: false
BlockPublicPolicy: false
IgnorePublicAcls: false
RestrictPublicBuckets: false
DeletionPolicy: Retain
BuckRogersSiteCachePolicy:
Type: "AWS::CloudFront::CachePolicy"
Properties:
CachePolicyConfig:
Comment: "Cache policy for buckrogerscountdowntodoomsday.com distribution"
DefaultTTL: 300 # five minutes
MaxTTL: 31536000
MinTTL: 60
Name: "buckrogers-cache-policy"
ParametersInCacheKeyAndForwardedToOrigin:
CookiesConfig:
CookieBehavior: none
EnableAcceptEncodingBrotli: true
EnableAcceptEncodingGzip: true
HeadersConfig:
HeaderBehavior: none
QueryStringsConfig:
QueryStringBehavior: none
BuckRogersSiteDistribution:
Type: "AWS::CloudFront::Distribution"
Properties:
DistributionConfig:
Aliases:
- buckrogerscountdowntodoomsday.com
Comment: "Frontend proxy for buckrogerscountdowntodoomsday.com"
DefaultCacheBehavior:
AllowedMethods:
- GET
- HEAD
CachedMethods:
- GET
- HEAD
CachePolicyId: !Ref BuckRogersSiteCachePolicy
Compress: true
TargetOriginId: s3-buckrogers-bucket
ViewerProtocolPolicy: "redirect-to-https"
DefaultRootObject: "index.html"
Enabled: true
HttpVersion: http2
IPV6Enabled: true
Origins:
- DomainName: !GetAtt BuckRogersSiteBucket.RegionalDomainName
Id: s3-buckrogers-bucket
S3OriginConfig:
OriginAccessIdentity: ""
ViewerCertificate:
AcmCertificateArn: "arn:aws:acm:us-east-1:592283802202:certificate/fe4dfe13-3768-4ae6-ad34-5492f7b25d60"
MinimumProtocolVersion: "TLSv1"
SslSupportMethod: "sni-only"
Tags:
- Key: app
Value: buckrogers
BuckRogersSiteDNS:
Type: "AWS::Route53::RecordSetGroup"
Properties:
Comment: "DNS for buckrogerscountdowntodoomsday.com CloudFront proxy"
HostedZoneName: "buckrogerscountdowntodoomsday.com."
RecordSets:
- Name: buckrogerscountdowntodoomsday.com
Type: "A"
AliasTarget:
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html#cfn-route53-aliastarget-hostedzoneid
HostedZoneId: "Z2FDTNDATAQYW2"
DNSName: !GetAtt BuckRogersSiteDistribution.DomainName
- Name: buckrogerscountdowntodoomsday.com
Type: "AAAA"
AliasTarget:
HostedZoneId: "Z2FDTNDATAQYW2"
DNSName: !GetAtt BuckRogersSiteDistribution.DomainName