2
votes

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?

2

2 Answers

6
votes

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

3
votes

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)