AWS Amplify re-domain mapping not allowed

0

We are using AWS Amplify to publish our NextJs based web application.

We are using AWS Organization to separate accounts.

We first deployed example.com to account1 to AWS Amplify and mapped domain.

Then, we went to another account (account2) and deployed another application to AWS Amplify but to the same domain.

Now it is throwing following error

com.amazonaws.services.cloudfront.model.CNAMEAlreadyExistsException: One or more aliases specified for the distribution includes an incorrectly configured DNS record that points to another CloudFront distribution. You must update the DNS record to correct the problem. For more information, see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html#alternate-domain-names-restrictions (Service: AmazonCloudFront; Status Code: 409; Error Code: CNAMEAlreadyExists; Request ID: c892c331-d8c6-4c16-9892-3557c8f8a2e6; Proxy: null)

Make SSL changes and try again
Consult the troubleshooting guide, make any necessary changes, and retry activation.

I went to old account1 and deleted the domain mapping. Waited for 2 hours. But still when I go and try setting the domain to account2's AWS Amplify, it is still throwing the same error.

The online articles suggest to go to CloudFront and remove the mapping, but since it is AWS Amplify, We don't have access to cloud front.

What can we do?

1 Answer
0

Hi Akshay,

I understand you want a simpler solution to fix the CNAMEAlreadyExistsException with AWS Amplify.

Ensure DNS Propagation (Wait 24 Hours):

The key is waiting for DNS propagation to complete. Deleting the domain mapping in account1 triggers a DNS update. It can take up to 24 hours for this change to reflect across the internet.

Redeploy Application in Account2:

  1. After waiting 24 hours, go to your Amplify project in account2.

  2. Redeploy your Next.js application using amplify push.

  3. Amplify will attempt to create a new CloudFront distribution and associate it with example.com during this redeployment.

Yeah I think after these considerations This should resolve the issue and allow you to map your domain to the new application in account2.

Amplify Troubleshooting Guide: https://docs.aws.amazon.com/amplify/latest/userguide/custom-domain-troubleshoot-guide.html

answered 24 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions