1

I have a cloudfront distribution (d123.cloudfront.com), which I am trying to add a cname for (static.dev.mysite.com). I have added a CNAME and TXT DNS entry as recommended on this AWS support page https://aws.amazon.com/premiumsupport/knowledge-center/resolve-cnamealreadyexists-error/

$ dig +short static.dev.mysite.com TXT
"d123.cloudfront.net"

$ dig +short static.dev.mysite.com CNAME
d123.cloudfront.net.

But when I go to add it in the AWS console by editing my distribution and filling the "Alternate Domain Names (CNAMEs)" field I get the following error

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: 02cac56a-4de6-11e8-b008-0fd430b1b7c4)

This domain is not used anywhere else in AWS at the moment.

3
  • The page you are referring says that you need to contact AWS support after TXT record created.
    – AlexD
    May 2, 2018 at 9:50
  • @jamesj if your site is static.dev.example.com, an important question is whether you have multiple AWS accounts, and if so, whether one of your other accounts has *.dev.example.com or *.example.com configured in CloudFront. If that is the case, you're hitting a safety check that prevents hijacking wildcards across AWS account boundaries. Confirm? May 2, 2018 at 15:37
  • @Michael-sqlbot I think my client has another cloudfront distribution set up in a different account with *.example.com
    – jamesj
    May 4, 2018 at 12:46

2 Answers 2

2

Excerpt from the AWS support page you are referring:

After the record is created, contact AWS Support and ask that AWS verify the ownership of the DNS domain name to be sure that you can add the CNAME alias to your distribution. Be sure that you provide a copy of the CNAMEAlreadyExists error message in your case with AWS Support.

3
  • 2
    Thanks, now unfortunately I get the message "Technical Support Unavailable under the Basic Support Plan"
    – jamesj
    May 2, 2018 at 10:02
  • @jamesj You can sign up for it for a month, get help, and cancel. Will cost you a couple bucks at most, as it's prorated when you cancel.
    – ceejayoz
    May 2, 2018 at 12:53
  • @jamesj You should be able to ask AWS Support for assistance with this issue even without paid support, as long as you can prove to them that you own the domain name you are trying to add to the alternate domain name of your CloudFront distribution. Also here are two very good answers with in-depth explanation to the issue you're facing: - stackoverflow.com/a/41549271/2039449 - stackoverflow.com/a/52788097/2039449
    – Sergei
    Feb 19, 2021 at 8:36
0

For anyone who may see this in the future and panic - you will need to delete the CNAME record in your DNS, add the alternate CNAME into CloudFront and then add it back to the DNS once the configuration is saved.

Either that or wait a day (or less, not sure) and it will work.

If you cannot wait, you can simply add *.domain.com for now and update it the next day.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .