I am trying to host a websit with only static pages on BitBucket.com using its Add-On Aerobatic. While registering the domain on Aerobatic, its giving me the following error:

CNAME already registered with CloudFront
AWS is reporting that this domain is already registered with a different CloudFront distribution. In order to complete the registration process, you'll first need to disable that distribution.

I never registered the domain with AWS CloudFront and hence can't figure out what is going on.

Any clue to this problem would be greatly appreciated.

Thanks,
Sourin

4

There are 4 answers

6
Michael - sqlbot On

This issue can have several possible causes.

CloudFront treats alternate domain names (which they also call "CNAMEs" even though this doesn't imply that actual CNAME records necessarily exist in DNS) as a single global namespace.

No two CloudFront distributions can have the same alternate domain name, whether in the same AWS account or in different accounts.

Additionally, no two CloudFront distributions can have ambiguous alternate domain names, unless they are owned by the same AWS account. An example of ambiguous names would be *.example.com and www.example.com. This is ambiguous because *.example.com also matches www.example.com. This configuration is accepted and works correctly, but only if both distributions are in the same account.

Additionally, API Gateway edge-optimized APIs use the CloudFront network, so their custom hostnames are part of the globally-unique CloudFront namespace mentioned above, with the additional caveat that ambiguous mappings are not supported when API Gateway edge optimization is used.

Not all of the possible conditions here are directly applicable to the exact circumstances in the question above, but here is a list of some possibilities to consider:

  • another AWS customer who formerly owned the domain still has a CloudFront distribution configured with this hostname, or
  • there may be someone who has configured it on one of their CloudFront distributions by mistake, such as mistakenly creating an alternate domain name value of example.com (your domain) when the intended value should have been example.org (their domain), or
  • you created an API Gateway edge-optimized deployment using this domain. This is not applicable to regional deployments, only edge-optimized.

If you're certain that none of the above conditions are applicable in such a way that you can fix this yourself (i.e. it's not already configured in one of your CloudFront distributions in any of your AWS accounts or in API Gateway) then see How do I resolve the error CNAMEAlreadyExists when setting up a CNAME alias for my Amazon CloudFront distribution? in the AWS Support Knowledge Base for the process to get CloudFront to unlock the domain, using a special TXT record in DNS, followed by an AWS support request.

If you don't have a paid technical support plan, this should also be possible by submitting an account support request, since you are asking them to fix the setup of your account, not fix or troubleshoot your systems or code, etc.

0
Joseph Goksu On

I encountered the same problem with a newly provisioned domain. However, I discovered that the issue lied elsewhere. I have been utilising AWS Amplify and had configured the same domain there. After removing the Amplify domain setup, the cloudfront deployment functioned perfectly.

Note: AWS Amplify uses CloudFront in the background.

0
Vlad Holubiev On

I had the same problem when creating a distribution from scratch with an alternate domain name from the beginning.

Nothing of what Michael described helped in my case.

What helped is to:

  1. Create a distribution without an alternate domain name
  2. Create Route53 alias record to the distribution
  3. Set the alternate domain name in distribution back
0
Lucia Clifford On

I had the same problem and resolved it by:

  1. Deleting the DNS CNAME
  2. Updating the alternative domain to my subdomain app.example.com
  3. Add CNAME again with the new cloudfront endpoint: enter image description here