8

I am trying to setup AWS Cloudfront distribution and route traffic from one of my subdomains to Cloudfront.

As per AWS documentation, I created and added a certificate to Cloudfront, then define alternative domain with that subdomain. However I always encountered this error:

CNAME error

I have checked thoroughly that I do not have another CNAME record which is associated with that subdomain.

I also tried to follow this guide from AWS to find any conflicting alias setup: https://aws.amazon.com/premiumsupport/knowledge-center/resolve-cnamealreadyexists-error/ but the problem is that my aws cli doesn't even have list-conflicting-aliases command. I am really stuck here. Any help will be appreciated. Thanks.

2
  • 3
    Have you found the solution to this? Commented Jul 11, 2022 at 14:37
  • Facing the same issue Commented Nov 1, 2022 at 18:41

2 Answers 2

8

You will get this error if you've already used this subdomain in another AWS account.

Delete previous CloudFront distribution in that AWS account before you can create CloudFront distribution in the new account.

1
  • That was the solution for me. It happened because it was a domain of Route 53 previously created on an other account with its CloudFront certificate associated. Once deleted, I was able to add example.com to the new account
    – Selorb
    Commented Dec 13, 2022 at 20:40
0

Helped out this document https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html#alternate-domain-names-move

  1. Added DNS record like this:

    _www.example.com TXT d111111abcdef8.cloudfront.net

  2. Moved CNAME with the command:

    aws cloudfront associate-alias --alias www.example.com --target-distribution-id EDFDVBD6EXAMPLE

My case was to move CNAME between CloudFront distributions within the same account, but the document also describes cross-account movement.

Not the answer you're looking for? Browse other questions tagged or ask your own question.