A bucket can serve its objects as a website: a request for / gets the home page, and a missing page gets an error page.
Turning it on
sh
aws s3 website s3://monster-market-1fs9dow --index-document index.html --error-document error.html--index-document names the object that answers a request for /. --error-document names the page a visitor sees when they ask for a key that does not exist.
The website endpoint
The site answers on its own address:
http://monster-market-…the bucket.s3-website-us-east-1its region.amazonaws.com
It is plain http. A later chapter puts HTTPS and a real domain name in front of it.
Checking it
sh
curl -I http://monster-market-1fs9dow.s3-website-us-east-1.amazonaws.com/-I asks only for the headers. The first line is the status line:
text
HTTP/1.1 200 OK| Status | Means here |
|---|---|
200 OK | the page was served |
403 Forbidden | the bucket policy does not let the public read it |
404 Not Found | no object has that key; the body is your error page |
sh
curl -s http://monster-market-1fs9dow.s3-website-us-east-1.amazonaws.com/Without -I, curl prints the page itself.