7

For some reasons I am not able to set up my static website in S3. I am trying to resolve this from last 2 weeks but its not working for me.

What I have done is:

  1. Uploaded files within S3 bucket.
  2. Set up routing policy - thats fine.
  3. Alias target dropdown - I can see the S3 endpoints.
  4. Created Hosted zones.
  5. Set up both the alias with and without WWW.

Result - When I am typing URL in the address bar, it throws an error..either site is down or DNS related errors.

I tried implementing the same steps 6-7 times,No problems at all but domains are not working in the end. Absolutely clueless where I am going wrong?

John Rotenstein
  • 165,783
  • 13
  • 223
  • 298
KapilS
  • 99
  • 1
  • 2
  • 9
  • Can you provide the DNS entires that are not working? Note, since you are using s3 website, you will need a bucket that matches the DNS name. So for example.com & www.example.com, you will need two buckets. – imperalix Dec 17 '14 at 00:58
  • Yes i created the buckets with same name and created two buckets – KapilS Dec 17 '14 at 09:22

3 Answers3

21

Your hosted zone and domain name servers could be out of sync:

In Route 53, verify the Name Servers (NS) generated by your Hosted Zone match what's listed under your Registered Domains.

SCREENSHOT: AWS Route 53 Top Left Menu - Hosted vs Registered Domains

  1. Click on "Hosted Zones"
  2. Select your domain (example.com)
  3. Select the "Record Set" with type NS
  4. Copy each line item / name server from the value box

    ns1.amazon.com

    ns2.amazon.org

    ns3.amazon.net

    ns4.amazon.co.uk

  5. Now click on "Registered Domains"

  6. Select your domain

  7. Past each entry in the upper right hand corner

SCREENSHOT: Paste example.com Name Server Entries

Shane Gramlich
  • 311
  • 2
  • 7
  • 1
    Thx, this was what I needed after ending up with a mess with hosted zones. – Pawel.W Apr 11 '16 at 17:25
  • 1
    I assumed that the Name Servers generated by my Hosted Zone automatically matched what was listed under Registered Domains. Upon a second check, I realized that this was not the case. Thanks! – Jihoon Baek Sep 12 '17 at 01:39
  • 1
    I took for granted that AWS uses the name servers mentioned in the hosted zone. Kudos! – Abhirath Mahipal Sep 29 '17 at 05:36
  • 1
    Yeah, this was a problem for me too. A couple of possible contributing factors: 1) I transfered this domain from squarespace to amazon; 2) I created and deleted a few hosted zones while I was messing around with stuff. Either way, it got out of sync and this worked great. – IanK Feb 10 '18 at 17:20
  • 1
    Yep, this was my exact problem, I transferred my domain from godaddy but didn't update the ns records in route53. – nmcdonald Jun 28 '18 at 12:46
3

The major steps to create an Amazon Route 53 alias to an Amazon S3 bucket are:

  • Create a bucket with the DNS name (eg images.my-company.com) -- note that the Bucket Name must match the DNS that you wish users to enter when accessing the URL
  • Activate Static Website Hosting on the Amazon S3 Bucket
  • In Route 53, create a Hosted Zone or use an existing Hosted Zone
  • Create a Record Set in the Hosted Zone
    • Name: Match the subdomain to the name of your S3 Bucket
    • Type: A
    • Alias: Yes
    • Alias Target: Select your S3 website from the pull-down list

See: Setting Up a Static Website Using a Custom Domain

The most important part is that the Bucket must have the same name as the Route 53 domain name (eg images.my-company.com).

If problems are experienced, first try to access the content via the Static Website URL. If that works, resolve the URL (eg via DNSLOOKUP or PING) and compare the IP address to a resolution of your domain name. They should both return the same IP address.

John Rotenstein
  • 165,783
  • 13
  • 223
  • 298
  • Ah some more things... The objects in your S3 bucket must be set with public access, either on each object or via a Bucket Policy that makes all content public. Test the static website by using its "normal" URL (without Route 53). Then, change the domain portion of the URL to use the Record Set defined in Route 53. If you just go to www.cookiecrm.com, it will try to redirect to the Index page defined on your Static Website settings. – John Rotenstein Dec 17 '14 at 11:21
  • Also I have set the proper Alias and details are cookiecrm.com. NS ns-492.awsdns-61.com. ns-1135.awsdns-13.org. ns-1793.awsdns-32.co.uk. ns-719.awsdns-25.net. - - 172800 cookiecrm.com. SOA ns-492.awsdns-61.com. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400 - - 900 cookiecrm.com. A ALIAS s3-website-us-west-1.amazonaws.com (z2f56uzl2m1acd) No - www.cookiecrm.com. A ALIAS s3-website-us-west-1.amazonaws.com – KapilS Dec 17 '14 at 11:36
  • I can also see the bcuket endpoints in URL which means endpoints name,domain are matching – KapilS Dec 17 '14 at 11:37
  • 1
    Your bucket name must EXACTLY MATCH your domain name. Is the bucket called "www.cookiecrm.com"? If you want both "cookiecrm.com" AND "www.cookecrm.com" to point to the same bucket, you'll need to setup 2 buckets, and configure S3 to redirect one to the other. You'll also need 2 Record Sets in Route 53. Try and get one bucket working first, with your Record Set matching the bucket name. – John Rotenstein Dec 17 '14 at 19:23
  • Hi John,My buckets names are exactly matching.I have created two buckets with name cookiecrm.com and www.cookiecrm.com and created two record sets as mentioned above.I can see bucket endpoints in the ALIAS dropdown as well. – KapilS Dec 18 '14 at 04:01
2

I find a solution.

It seems I deleted my hosted zone which was created by amazon first time against my domain name.

Later when i created my hosted zone again against same domain name I am supposed to update nameservers in the hosted zone page which resolved the conflict of name server resolution

KapilS
  • 99
  • 1
  • 2
  • 9
  • Hi KapilS how did you resolve the conflict of the name server resolution? I deleted my hosted zone as well, and have recreated it, however the domain still won't resolve to my S3 bucket (with a static web site). What did you update the name servers to? Many thanks – emson Nov 13 '15 at 14:13