UNPKG

@vifraa/fastsite

Version:

Tool for deploying static websites to AWS, automatically creating an S3 Bucket and Cloudfront deployment

66 lines (65 loc) 1.82 kB
AWSTemplateFormatVersion: 2010-09-09 Resources: WebDistribution: DependsOn: - WebBucket Type: AWS::CloudFront::Distribution Properties: DistributionConfig: Enabled: true Origins: - DomainName: !Select [2, !Split ["/", !GetAtt WebBucket.WebsiteURL]] Id: S3Origin CustomOriginConfig: HTTPPort: '80' HTTPSPort: '443' OriginProtocolPolicy: http-only DefaultRootObject: index.html PriceClass: PriceClass_100 CacheBehaviors: - DefaultTTL: 0 MaxTTL: 0 MinTTL: 0 PathPattern: index.html TargetOriginId: S3Origin ViewerProtocolPolicy: allow-all ForwardedValues: QueryString: 'false' DefaultCacheBehavior: TargetOriginId: S3Origin ForwardedValues: QueryString: 'false' ViewerProtocolPolicy: allow-all WebBucket: Type: AWS::S3::Bucket Properties: AccessControl: PublicRead WebsiteConfiguration: IndexDocument: index.html ErrorDocument: error.html BucketPolicy: Type: AWS::S3::BucketPolicy Properties: PolicyDocument: Id: PublicRead Version: 2012-10-17 Statement: - Sid: PublicReadForGetBucketObjects Effect: Allow Principal: '*' Action: 's3:GetObject' Resource: !Join - '' - - 'arn:aws:s3:::' - !Ref WebBucket - /* Bucket: !Ref WebBucket Outputs: WebsiteURL: Value: !GetAtt - WebDistribution - DomainName Description: URL for website hosted on S3 S3BucketName: Value: !Ref 'WebBucket' Description: Name of the S3 Bucket