Created
September 16, 2021 04:07
-
-
Save LuisEnMarroquin/62dd8571f74a895c627da50ca697f61b to your computer and use it in GitHub Desktop.
aws cloudformation create-stack --stack-name public-bucket-for-spa --template-body file://./spa-bucket.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AWSTemplateFormatVersion: '2010-09-09' | |
| Description: S3 bucket for SPA and public read policy | |
| Parameters: | |
| BucketName: | |
| Type: String | |
| Default: my-unique-bucket-name-123456789 | |
| Resources: | |
| MyS3Bucket: | |
| Type: AWS::S3::Bucket | |
| Properties: | |
| AccessControl: PublicRead | |
| BucketName: !Ref BucketName | |
| WebsiteConfiguration: | |
| ErrorDocument: index.html | |
| IndexDocument: index.html | |
| MyS3Policy: | |
| Type: AWS::S3::BucketPolicy | |
| Properties: | |
| Bucket: !Ref MyS3Bucket | |
| PolicyDocument: | |
| Version: '2012-10-17' | |
| Id: EverythingIsPublic | |
| Statement: | |
| - Sid: PublicReadForGetBucketObjects | |
| Effect: Allow | |
| Principal: "*" | |
| Action: s3:GetObject | |
| Resource: !Join | |
| - '' | |
| - - 'arn:aws:s3:::' | |
| - !Ref BucketName | |
| - /* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment