How to setup CNAME for Amazon S3 at Namecheap
Asked Answered
T

2

19

I am using amazon S3 to host one of my static sites and wanted to link it to my domain name (domainname.co.uk). So I went into namecheap account-all host records and did something like this,

Screenshot of Namecheap control panel

However, It still doesnt work and throws 404 when I go the website url. By the way, under the "www" option, I am using my S3 url like this, conxxxxxxxxxxx.co.uk.s3-website-eu-west-1.amazonaws.com..

Notice the dot in the end, which is automatically added by Namecheap whenever I try to save, even without the dot. I am not sure if that's causing the issue but it just doesn't work for me.

Going directly to my AWS URL works fine, which implies that something is wrong with my CNAME setup.

Anyone know what am doing wrong here? Namecheap support had absolutely no clue either.

Trish answered 15/7, 2012 at 16:5 Comment(2)
The dot is intended its called a full stop. Without it, the DNS will try to resolve conxxxxxxxxxxx.co.uk.s3-website-eu-west-1.amazonaws.com.yourdomain.co.uk . EDIT: ps it's really hard to troubleshoot DNS issues without the actual domain names.Jeanette
the trailing dot identifies a fully qualified domain nameTriphylite
C
15

You can only use custom CNAMEs for Amazon S3 if the bucket name matches the CNAME.

For example, if your bucket is named:

files.example.com

and is therefore accessible by default at:

files.example.com.s3-website-us-east-1.amazonaws.com.

A CNAME from files.example.com to the full bucket domain name will allow you to use your custom domain.

However, if your bucket name is not exactly the same as the CNAME you are trying to define, it will not work. In your screenshot, you are trying to use www.... as your CNAME, but the (redacted) bucket name does not contain www.. Note that "exactly" includes case-sensitivity; your bucket name must be all lowercase for a CNAME to work.

The full documentation of this feature is here: http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#VirtualHostingCustomURLs


If you want/need multiple CNAMEs, and/or a CNAME that does not match the bucket name, Amazon CloudFront allows you to specify arbitrary CNAMEs for a deployment.

Common answered 12/3, 2013 at 5:3 Comment(2)
Can a root domain in Namecheap point to an S3 bucket? It seems CNAME only works for root domains if the target is an IP address.Brycebryn
Nevermind, it turns out an ALIAS record can be used to point a Namecheap root domain to an S3 bucket. (Took a couple of hours before the change propagated, so I thought at first that it didn't work.)Brycebryn
D
3

Its been a while since this questions was asked , but if anyone looking for NameCheap CNAME setup for static website in amazon AWS s3 bucket then please refer screenshot below. This setup for AWS S3 bucket hosting + NameCheap DNS record is working for me as of Jul 2019.

NameCheap CNAME record for AWS S3 website hosting

This setup is for pointing AWS S3 static website endpoint to your custom domain in NameCheap.

AWS S3 website endpoint

Please note if you are using AWS CloudFront SSL certificate then your CNAME record value will be the CloudFront domain name ( not the static website endpoint).

Delk answered 4/7, 2019 at 8:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.