S3 hosting static website
This method hosts the static website in a similar way that github pages do. It is quite similar to host a website with dynamic domain name, since they are all based on amazonaws.com root domain.
Steps
- Enter your s3 Service interface. (Services → Storage Category → S3)
- Create bucket, name it like a website url.
- Upload a index.html file.
- Upload an error.html file so that if the browser enters a page that does not exist, this page will be shown.
- Go into your website bucket → Adjust Settings → Static website hosting Enable → Specify index.html and error.html.
- Go to Permissions → Edit Block Public Access → Unlock Block all Public Access.
- Edit Bucket Policy,
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::{url}/*" ## please replace url with your website domain name
}
]
}
- Objects Tab → Select all files → Actions → Make Public
- Now you can see your page with accessible endpoint, in format http://{url}.s3-website.{region}.amazonaws.com .
References