Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
79 lines (77 sloc) 2.36 KB
service:
name: example-app
provider:
name: aws
region: ap-southeast-2
resources:
Resources:
FrontPageWebsiteBucket:
Type: AWS::S3::Bucket
FrontPageWebsiteBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref FrontPageWebsiteBucket
PolicyDocument:
Statement:
- Effect: Allow
Action:
- s3:GetObject
Resource:
Fn::Join:
- /
- - Fn::GetAtt:
- FrontPageWebsiteBucket
- Arn
- '*'
Principal:
CanonicalUser:
Fn::GetAtt:
- FrontPageWebsiteOriginAccessIdentity
- S3CanonicalUserId
FrontPageWebsiteOriginAccessIdentity:
Type: AWS::CloudFront::CloudFrontOriginAccessIdentity
Properties:
CloudFrontOriginAccessIdentityConfig:
Comment: Origin Access Identity to Access Website Bucket
FrontPageCloudFront:
Type: AWS::CloudFront::Distribution
DependsOn:
- FrontPageWebsiteBucket
Properties:
DistributionConfig:
Origins:
- DomainName:
Fn::GetAtt:
- FrontPageWebsiteBucket
- RegionalDomainName
Id: S3Origin
S3OriginConfig:
OriginAccessIdentity:
Fn::Join:
- /
- - origin-access-identity
- cloudfront
- !Ref FrontPageWebsiteOriginAccessIdentity
CustomErrorResponses:
- ErrorCachingMinTTL: 0
ErrorCode: 403
ResponseCode: 200
ResponsePagePath: /index.html
DefaultCacheBehavior:
AllowedMethods:
- GET
- HEAD
Compress: true
ForwardedValues:
QueryString: true
Cookies:
Forward: none
TargetOriginId: S3Origin
ViewerProtocolPolicy: redirect-to-https
Comment: my example website in s3
DefaultRootObject: index.html
Enabled: true
HttpVersion: http2
PriceClass: PriceClass_All
ViewerCertificate:
CloudFrontDefaultCertificate: true
You can’t perform that action at this time.