Set up WWW Domain Redirect

From @jayair on Mon Apr 10 2017 01:09:47 GMT+0000 (UTC)

Link to chapter -

Copied from original issue:

From @pjamieson on Mon Jul 03 2017 20:01:42 GMT+0000 (UTC)

Rather than create a second CloudFront Distribution, why not just add the alias www.[my-domain].com to the Route53 Record Sets for [my-domain]–pointing to the first distribution–then add www.[my-domain].com to that first distribution’s Alternate Domain Names? That seems to work fine. Am I missing something?

From @jayair on Mon Jul 03 2017 20:33:01 GMT+0000 (UTC)

@pjamieson The reason we set up a redirect on our alternate domain is for SEO purposes. Not necessarily for ranking but because we don’t want two versions of our domain active. By re-directing one (the www or apex domain) to the other we are telling the search engines to use one as opposed to both. I hope that makes sense.

From @pjamieson on Mon Jul 03 2017 20:45:12 GMT+0000 (UTC)

Thanks, @jayair. That makes sense.

From @jayair on Mon Jul 03 2017 21:12:26 GMT+0000 (UTC)

@pjamieson Just added a small note to the chapter

From @x11joe on Sat Nov 11 2017 12:02:09 GMT+0000 (UTC)

I’m getting the following error on this step, One or more of the CNAMEs you provided are already associated with a different resource. (Service: AmazonCloudFront; Status Code: 409; Error Code: CNAMEAlreadyExists; Request ID: e21a6bde-c6d7-11e7-9415-837f645450a5), any ideas?

My bucket name is definitely different, so not sure…

From @jayair on Sat Nov 11 2017 19:37:26 GMT+0000 (UTC)

@x11joe This usually has to do with a CloudFront distribution having a CNAME already listed as the one you are trying to add. On which screen are you seeing this?

From @x11joe on Sat Nov 11 2017 20:10:14 GMT+0000 (UTC)

I am seeing this on the part where you say … Scroll down to the Alternate Domain Names (CNAMEs) and use the www version of our domain name here.

It shows up at the bottom, I’ll try and get a screenshot.

Well… this is going to sound stupid but I tried just now and its working all the sudden?? Maybe this happened because I was doing test with the domain name prior on another serverless tutorial and it takes like 24 hours for it to remove it’s self? Not sure. Maybe this post will help someone.

From @jayair on Sat Nov 11 2017 20:14:39 GMT+0000 (UTC)

@x11joe Yeah this can happen. Both the domain setting part and the CloudFront distributions take some time to apply their changes.

From @johnnybigert on Mon Nov 27 2017 15:09:01 GMT+0000 (UTC)

I just registered a domain (let’s call it “”) and it shows the Notes app correctly. The s3 url and the cloudflare distribution url also show the Notes app. When trying to get the redirect from to work, I get the following behavior: redirects correctly to However, and (which is the www cloudfront distribution url) both give

This XML file does not appear to have any style information associated with it. The document tree is shown below.
  <Message>Access Denied</Message>

I have looked through the settings of the s3 redirect bucket, the www cloudfront distribution and the hosted zone record sets and they seem correct. Any ideas what to do?


I’ve just run into this myself and was wondering if you resolved it.


Which issue are you referring to?

I have exactly the same problem, did you find the solution?
many thanks.

I think @rjison9000 refers to the ‘Access Denied’ problem.

Whats the issue you are having?

I have already solved my problem with this

thank you very much


if its only in effect a redirect, we could avoid route 53 and cloudfront and save ourselves some money a month by doing it from the registrars website, no?

You could but the cost for this extremely small.

Why create a CloudFront distribution for the www redirect? Is it necessary?

Or could you have the alias record point directly to the S3 bucket?


I think you could. We used the CF for the sake of completeness.