2
votes

I'm learning some web development and am using Amazon S3 as a web host with a custom domain from Google domains. I used the guides from the Amazon AWS page and was able to set up the web page but I have a problem with getting the custom domain to work.

For example, Amazon S3 has the endpoint URL to www.example.com.s3-website-us-east-1.amazonaws.com and I want my domain example.com to show up. When I load the page for www.example.com, it loads the page however it still shows the example.s3-website-us-east-1.amazonaws.com when I want it to show the simple example.com instead.

From what I can tell, I need a CNAME, I've set it up as www.example.com -> www.example.com.s3-website-us-east-1.amazonaws.com with permanent redirect (301) and forward path.

Please help!

2
Check the setup on the www bucket. "Redirect all requests to another hostname" should say "example.com" -- not the endpoint for the example.com bucket. - Michael - sqlbot
Did you follow the directions on Setting Up a Static Website Using a Custom Domain? Specifically, is your bucket name set to your domain name? - John Rotenstein
@John Rotenstein Yes that is what I followed, I have www.example.com and example.com as a bucket as well. I don't have any Route 53 set up though, and I'm not sure if it's required in this case? - Tenza
@Michael - sqlbot I have changed my www bucket to now redirect all requests to example.com instead of the endpoint. I'm not sure if it will be of any help, but the site in question is khatri.cc - Tenza
It looks like you are using S3 behind Cloudflare. The site seems to be working correctly. - Michael - sqlbot

2 Answers

2
votes

If anyone was wondering how I got it to work, I ended up using Cloudflare with its free DNS options. I added the DNS servers to google domains and then added two CNAMES:

@ -> example.com -> example.com.s3-website-us-east-1.amazonaws.com (for the root)

CNAME -> www -> www.example.com.s3-website-us-east-1.amazonaws.com (for the www redirect)
0
votes

On the Google side, configure the CNAME record (www) to point to s3.amazonaws.com. (yes, the dot included) ... like this:

enter image description here

... and wait a few minutes.

Make sure your S3 bucket is named: www.yourdomain.com