To make an S3 bucket serve a website,
- go to your bucket in aws
- to properties
- open static website hosting
- hit enable website hosting
- set index document to
index.html
(possibly set error document too) - add the bucket policy below, with your bucket's name swapped in
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::your-bucket-name-here/*"
]
}
]
}