title: Serving Website From S3 Using Cloud Front & Route 53
body: <p>I just recently moved my domain name from a hosting provider to Amazon. I want to host my website using S3 buckets and I originally I tried to set up my buckets to be <code>domain.com</code> and <code>www.domain.com</code> but I think my previous hosting provider took these bucket names because I cannot create them.</p>
  
  <p>So I am looking at a work around now ... <br>
  - created a new bucket with a unique name and put my website files in it <br>
  - I set up Cloud Front to pull the files from that bucket <br>
  - and lastly a Route 53 hosted zone with the CNAMES for <code>domain.com</code> and <code>www.domain.com</code> pointing to that Cloud Front. </p>
  
  <p>Here is where my problem comes in. I cannot add <code>www.domain.com</code> to my CNAMEs in the Cloud Front. I get the following error:</p>
  
  <pre><code>com.amazonaws.services.cloudfront.model.CNAMEAlreadyExistsException: 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: 19a9a141-8b15-11e6-aa8f-87e12f4b3abf)
  </code></pre>
  
  <p>However, it does accept <code>domain.com</code> ... so when I visit <code>domain.com</code> I get the proper website, but when I visit <code>www.domain.com</code> I get the old website.</p>
  
  <p>I think it is due to the fact that I can't add that CNAME in my Cloud Front. How can I fix this error?</p>
  
  <p>Thank you</p>