feat: add a cloudfront distribution to host a static website
This commit is contained in:
parent
414897d9a9
commit
793fb44aba
1 changed files with 41 additions and 0 deletions
41
template-cloudfront.yaml
Normal file
41
template-cloudfront.yaml
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
AWSTemplateFormatVersion: '2010-09-09'
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
WebsiteBucketName:
|
||||||
|
Type: String
|
||||||
|
Description: "The name for the S3 bucket to be used for public website hosting (must be globally unique)"
|
||||||
|
Default: "naputo-blog-public"
|
||||||
|
|
||||||
|
Resources:
|
||||||
|
BlogCloudFrontDistribution:
|
||||||
|
Type: AWS::CloudFront::Distribution
|
||||||
|
Properties:
|
||||||
|
DistributionConfig:
|
||||||
|
Enabled: true
|
||||||
|
Origins:
|
||||||
|
- Id: S3WebsiteOrigin
|
||||||
|
DomainName: !Sub "${WebsiteBucketName}.s3-website-${AWS::Region}.amazonaws.com"
|
||||||
|
CustomOriginConfig:
|
||||||
|
HTTPPort: 80
|
||||||
|
HTTPSPort: 80
|
||||||
|
OriginProtocolPolicy: http-only
|
||||||
|
DefaultCacheBehavior:
|
||||||
|
TargetOriginId: S3WebsiteOrigin
|
||||||
|
ViewerProtocolPolicy: redirect-to-https
|
||||||
|
AllowedMethods:
|
||||||
|
- GET
|
||||||
|
- HEAD
|
||||||
|
CachedMethods:
|
||||||
|
- GET
|
||||||
|
- HEAD
|
||||||
|
ForwardedValues:
|
||||||
|
QueryString: false
|
||||||
|
Cookies:
|
||||||
|
Forward: none
|
||||||
|
Aliases:
|
||||||
|
- blog.n-daisuke897.com
|
||||||
|
ViewerCertificate:
|
||||||
|
AcmCertificateArn: "arn:aws:acm:us-east-1:692859919890:certificate/4d3e8182-71e0-4ccb-a437-36523f61a6c0"
|
||||||
|
SslSupportMethod: sni-only
|
||||||
|
MinimumProtocolVersion: TLSv1.2_2021
|
||||||
|
PriceClass: PriceClass_200
|
||||||
Loading…
Add table
Add a link
Reference in a new issue