Last active
April 5, 2020 00:12
-
-
Save jeanlescure/0fe1e5645e4c40482f277222f99fafe5 to your computer and use it in GitHub Desktop.
Bash Script and Policy JSON to create S3 Bucket Website for React.js app using AWS CLI
This file contains 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
aws s3 mb s3://my-react-site-bucket | |
aws s3api put-bucket-acl --bucket my-react-site-bucket --grant-read 'uri="http://acs.amazonaws.com/groups/global/AllUsers"' | |
aws s3 website s3://my-react-site-bucket --index-document index.html --error-document index.html | |
aws s3api put-bucket-policy --bucket my-react-site-bucket --policy file://bucket.policy.json |
This file contains 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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowPublicReadAccess", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::my-react-site-bucket/*" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment