The usual approach calls for pointing
But suppose that I would like not to redirect. In other words, I would like to set up a naked root domain, without setting up any sub-domains, not even
I am using Route53 and S3. Presumably I would need just one hosted zone (
mysite.com). Do I still need two buckets (
www.mysite.com) or can I set up just mysite.com?
Best How To :
Set up the bucket, named for your domain name. The bucket name has to match exactly the address that shows in the browser's address bar.
Then, create an
A record at the root (apex) of the domain in Route 53, leaving the hostname empty, selecting "Yes" for
Alias, then select the bucket in the drop down list.
That is all you have to do.
If you create a "www"
CNAME pointing to the domain name itself, this will not work with S3 web site hosting, because the bucket name won't match what's in the address bar of the browser (and a CNAME does not cause the browser to change the address bar to the target).
Everything in DNS that points to S3 must have a corresponding bucket that matches the DNS entry. That's how it was designed.
Because people are often very prone to typing "www" in front of web site hostnames, you probably should create a second bucket with "www."+your domain name as the bucket name, then configure that bucket to redirect all requests to the root domain name, and set an additional
Alias record on S3 -- because that way if a user types "www.example.com" into their browser, it will hit the second bucket and redirect -- by changing the browser's address bar -- to the root domain... which almost certainly is what you actually want, from a usability perspective.