Skip to content

Instantly share code, notes, and snippets.

@jeanlescure
Last active April 5, 2020 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeanlescure/0fe1e5645e4c40482f277222f99fafe5 to your computer and use it in GitHub Desktop.
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
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
{
"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