I'm migrating my static website from one AWS account to another. I want to have zero downtime and decided to pull up the whole infrastructure on the second, then just switch the domain name's DNS records to the new hosted zone. The only problem I'm facing now is that I can't assign my domain name (mydomain.com) to the second CloudFront distribution as an alias and I get the error CNAMEAlreadyExists
. I've contacted AWS support but they told me I need a premium support plan to do this with their help... Basically one domain name can only be associated with a single CloudFront distribution globally at a time.
How could I do the migration between accounts without having to turn off the first distribution and enable the second, resulting in downtime?
Turns out you don't neccessarly need an
alias
to your CloudFront distribution, it works without one as well. It's only for verifying where the request is coming from. I ended up simply removing the alias from the old distribution and adding it to the new one. Then simply switch the domain's DNS records to the new hosted zone. Migrated without any downtime.