loom/scripts/cfn/loom.yaml
2022-02-26 11:56:46 -08:00

87 lines
2.7 KiB
YAML

AWSTemplateFormatVersion: "2010-09-09"
Description: "Loom static site"
Resources:
LoomSiteBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: "lucasfilmloom.com"
PublicAccessBlockConfiguration:
BlockPublicAcls: false
BlockPublicPolicy: false
IgnorePublicAcls: false
RestrictPublicBuckets: false
DeletionPolicy: Retain
LoomSiteCachePolicy:
Type: "AWS::CloudFront::CachePolicy"
Properties:
CachePolicyConfig:
Comment: "Cache policy for lucasfilmloom.com distribution"
DefaultTTL: 300 # five minutes
MaxTTL: 31536000
MinTTL: 60
Name: "loom-cache-policy"
ParametersInCacheKeyAndForwardedToOrigin:
CookiesConfig:
CookieBehavior: none
EnableAcceptEncodingBrotli: true
EnableAcceptEncodingGzip: true
HeadersConfig:
HeaderBehavior: none
QueryStringsConfig:
QueryStringBehavior: none
LoomSiteDistribution:
Type: "AWS::CloudFront::Distribution"
Properties:
DistributionConfig:
Aliases:
- lucasfilmloom.com
Comment: "Frontend proxy for lucasfilmloom.com"
DefaultCacheBehavior:
AllowedMethods:
- GET
- HEAD
CachedMethods:
- GET
- HEAD
CachePolicyId: !Ref LoomSiteCachePolicy
Compress: true
TargetOriginId: s3-loom-bucket
ViewerProtocolPolicy: "redirect-to-https"
DefaultRootObject: "index.html"
Enabled: true
HttpVersion: http2
IPV6Enabled: true
Origins:
- DomainName: !GetAtt LoomSiteBucket.RegionalDomainName
Id: s3-loom-bucket
S3OriginConfig:
OriginAccessIdentity: ""
ViewerCertificate:
AcmCertificateArn: "arn:aws:acm:us-east-1:592283802202:certificate/344bf713-1260-416d-a956-abff93b0a95e"
MinimumProtocolVersion: "TLSv1"
SslSupportMethod: "sni-only"
Tags:
- Key: app
Value: loom
LoomSiteDNS:
Type: "AWS::Route53::RecordSetGroup"
Properties:
Comment: "DNS for lucasfilmloom.com CloudFront proxy"
HostedZoneName: "lucasfilmloom.com."
RecordSets:
- Name: lucasfilmloom.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 LoomSiteDistribution.DomainName
- Name: lucasfilmloom.com
Type: "AAAA"
AliasTarget:
HostedZoneId: "Z2FDTNDATAQYW2"
DNSName: !GetAtt LoomSiteDistribution.DomainName