r/CloudFlare: Best method to migrate a large domain and subdomains to Cloudflare for DNS

r/CloudFlare: Best method to migrate a large domain and subdomains to Cloudflare for DNS
💡
This article archives a conversation, which took place in a subreddit post (original source linked below) and to which I contributed a solution or answer (with the u/MasterofSynapse handle), in a Q&A format.

Original Reddit post: https://www.reddit.com/r/CloudFlare/comments/yzplz3/best_method_to_migrate_a_large_domain_and/

Question

I have to move a large domain plus about 50 subdomains from my current DNS provider to Cloudflare DNS. The parent domain contains about 80 proprietary redirect records.

I was hoping I could first move the subdomains to cloudflare by setting them up as full domains on Cloudflare (sub.example.com). Once they were set up in Cloudflare, I was going to point NS records for the subdomain in the parent domain (example.com) on my current provider.

I've found out one can't activate the subdomain (sub.example.com) on Cloudflare if the parent domain is also not hosted on Cloudflare. Tech support suggested setting up the sub domains as Partial domains, but then I get no host name resolution because partial domains don't use Cloudflare DNS for name resolution.

I'm clearly missing a piece of the puzzle. Cloudflare Tech Support doesn't seem to understand what I'm trying to do. I also don't understand how to set up the URL redirects. Do I use the redirects rules or the page forwarding rules? I've been unable to find any documentation at Cloudflare that provides robust information on how to migrate a domain and subdomains from another DNS provider.

Any advice would be most appreciated.

Answer

Regarding redirects, please read my guide on that topic: https://epsilonsynapse.com/tech-salvation/definitive-guide-on-cloudflare-redirects/

For migration of the DNS records, /u/cyberjew420 has given you excellent advice. Either import a BIND-compliant file and then worry about Orange vs Grey cloud later. Or start out on the right foot which will save you work for years to come and utilize Infrastructure as Code with Terraform. Or any alternative IaC software for DNS, Cloudflare themselves for example use OctoDNS instead of Terraform for their DNS management.

Further articles:

https://blog.cloudflare.com/terraforming-cloudflare-at-cloudflare/ https://blog.cloudflare.com/improving-the-resiliency-of-our-infrastructure-dns-zone/ https://github.blog/2017-04-27-enabling-split-authority-dns-with-octodns/