# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 AWSTemplateFormatVersion: '2010-09-09' Description: 'sputnik - Website Bucket - Version %%VERSION%%' Parameters: IsWebsitePublic: Type: String Description: Do you want to make the public S3 website public ? Default: false AllowedValues: - true - false Conditions: MakeS3WebsiteBucketPublic: !Equals [ !Ref IsWebsitePublic, true ] Resources: websiteBucket: Type: AWS::S3::Bucket DeletionPolicy: Retain Properties: WebsiteConfiguration: IndexDocument: 'index.html' ErrorDocument: 'index.html' websiteBucketPolicy: Type: 'AWS::S3::BucketPolicy' Condition: MakeS3WebsiteBucketPublic Properties: Bucket: !Ref 'websiteBucket' PolicyDocument: Statement: Action: 's3:GetObject' Effect: 'Allow' Resource: !Join ['', ['arn:aws:s3:::', !Ref websiteBucket, '/*']] Principal: '*' Outputs: websiteBucket: Description: 'sputnik Website Bucket' Value: !Ref websiteBucket websiteBucketArn: Description: 'sputnik Website Bucket ARN' Value: !GetAtt websiteBucket.Arn websiteUrl: Description: 'sputnik Website URL' Value: !GetAtt websiteBucket.WebsiteURL