2

I have the static website hosted on S3 which is displaying correctly using the Amazon s3 link.

As per Amazon docs, I created two buckets, example.io & www.example.io. The example.io has the content (files) for the website; the www.example.io bucket is redirecting to the phlo.io bucket.

I am trying to configure Godaddy Apex domain DNS settings to redirect to the S3 bucket. As an example, the domain is http://example.io & I entered the settings in Godaddy domain DNS in the following form:

Type: CNAME
Name: www
value: example.io.s3-website.eu-west-2.amazonaws.com
TTL: 1 hour

However, the website is not displaying on the link http://example.io. How do I configure the apex domain to display the static website?

Reza Mousavi
  • 4,420
  • 5
  • 31
  • 48
Kayote
  • 14,579
  • 25
  • 85
  • 144
  • Possible duplicate of [Using GoDaddy Domain Hosting to link to Amazon S3 Website](https://stackoverflow.com/questions/5348068/using-godaddy-domain-hosting-to-link-to-amazon-s3-website) – yukashima huksay Sep 03 '19 at 14:49

2 Answers2

6

You can't, sorry... AWS do not provide an IP Address that you can add as the Apex A Record. This causes issues using S3, CloudFront, ELB, and API Gateway.

If you are using AWS Route53, you can set the Apex A Record as an "alias" to those other services in your AWS account. This is an AWS bespoke service to get around only being able to set an A Record IP Address as the Apex Address.

So you can either move your DNS to AWS, or use a www redirection service. This will provide you with an IP Address which will respond with a redirection to your www.example.io address. People often use services like wwwizer.com to do this for free: http://wwwizer.com/naked-domain-redirect


On further investigation, it turns out that GoDaddy offers http redirection in its DNS service. Here is a guide to setting up naked domain name redirection to the www sub domain: https://help.ghost.org/article/17-custom-domains-using-godaddy

Matt D
  • 3,289
  • 1
  • 15
  • 29
  • Thanks for the clarification, I am not clear on why. I followed the solutions as per this page, however, they didnt work. https://forums.aws.amazon.com/thread.jspa?threadID=84927 How can I link the godaddy domain with S3 bucket? – Kayote Oct 09 '18 at 21:03
  • Looks like GoDaddy has it's own apex domain redirector which looks promising: half way down this page: https://help.ghost.org/article/17-custom-domains-using-godaddy – Matt D Oct 09 '18 at 21:42
  • 1
    Your www.example.io bucket should be the one with the website files in, the example.io bucket is not required for this solution. Update the www CNAME in your DNS to the S3 address of www.example.io. Then the GoDaddy forwarder will redirect visitors to the naked domain name to the www CNAME. – Matt D Oct 09 '18 at 21:44
  • Thanks for the help. Just tried this. I copied the files to www.example.io bucket, redirected example.io bucket to the www.example.io bucket. Then, in godaddy, added the `CNAME` `www` value to example.io.s3-website.eu-west-2.amazonaws.com path. As per the ghost.org link above, added the subdomain `www.example.io` in the domain forwarding setting. However, this is still not functioning. – Kayote Oct 10 '18 at 09:08
  • Does the S3 Static Site work on the raw URL?: `https://www.example.io.s3-website.eu-west-2.amazonaws.com` – Matt D Oct 10 '18 at 09:58
  • thanks, the www.example.io is working, however, the apex domain is still not functional. Is it a matter of waiting a few hours for all records to be updated? Also, would you please clarify how this is working. I would have thought the apex should be the main link & the subdomain would redirect to the apex. However, we appear to be doing the opposite. To answer your question, yes, the aws link works. – Kayote Oct 10 '18 at 10:12
  • Unless you use AWS Route53, you cannot use the naked domain name with S3 Static Websites, because there is no IP Address to point the Apex A Record at. The redirection from the naked domain name to www is the workaround, either using a third party service, or the GoDaddy redirection within their DNS console. – Matt D Oct 10 '18 at 10:28
  • Thanks for the clarification. I will look into awsroute53 and raise a separate question if I encounter an issue. Thanks again for all the help. – Kayote Oct 10 '18 at 11:22
3

Steps to follow to redirect all traffic from www.yourdomain.com to www.yours3bucket.amazonaws.com

  1. Create a bucket with the same name as your domain name(in this case www.yourdomain.com), make it public and host it.
  2. Go to Godaddy DNS Server and Enter a CNAME Entry with host as www, Points to as www.yours3bucket.amazonaws.com and TTL as default. (This is to redirect all the traffic to your AWS S3 Bucket, It will only work with www.yourdomain.com and not with yourdomain.com if you do not set a forwarding as mentioned on step 3)
  3. Now also add a 301 forwarding to http://www.yourdomain.com or https://www.yourdomain.com. (This is to forward yourdomain.com to www.yourdomain.com)