Search code examples
amazon-web-servicesamazon-route53aws-certificate-manager

How can I use the same domain name in different AWS accounts?


I want to use the same domain name in different AWS account. The domain is hosted by AWS.

I have two accounts: Account A and Account B.

In Account A, I have created a certificate with AWS Certificate Manager to have a custom domain name like example.com.

What I want to achieve is using the same domain name in Account B. In order to do that I have created a new certificate with the same domain name in Account B and then in Route 53 I have created a new hosted zone with the same domain name. The certificate is issued via email validation for Account B.

I have created a S3 static website hosting and created CloudFront distribution with this domain name in Account B.

I have followed all the steps to create static website hosting from Use CloudFront to Serve a Static Website.

When I call the link example.com instead of navigating to the static website it gives the following error:

example.com’s server IP address could not be found. ERR_NAME_NOT_RESOLVED

My question is what should I do to use the same domain name in different AWS accounts?


Solution

  • I have come up with a solution. It seems that the record set in Account B does not work and requests the address to hosted zone in Account A so creating the record set in Account A and using the CNAME of the distribution in Account B is the solution. The request goes to the record set in Account A and then it routes to the distribution in Account B.

    The below diagram presents the solution:

    enter image description here