How to manage thousands of DNS subdomain records for SAAS service

domain-name-systemsaas

Question:
We have 7000+ DNS subdomains under cotoso.com, we want to map them to 2 IP address, e.g. subdomain1-4000 to IP1, 4001-7000 to IP2. What's the best way to do this?

Background:
Our company provides SAAS software. We have 1 root domain (let's say cotoso.com), and then assign one subdomain for each customer company (e.g. company1.cotoso.com, company1.cotoso.com). Each company logon and use our SAAS by given subdomain.

Previously, our business is small, we has only 1 service deployment. therefore, the DNS setup is pretty easy, just set A record to map *.cotoso.com to our load balancer.

As business grows, we are planning to make multiple deployments on different Datacenters. However, DNS becomes a big problem. Right now, we have about 7,000 customers, we want to move half of them to new datacenter, how do we setup the DNS record?

My throught is using 3 level domain:

*.southeast.cotoso.com A 1.2.3.4

*.south.cotoso.com A 1.2.3.5

however, there are conflict between 3level wildcard and 2 level wildcard DNS record, so we cannot migrate the existing users to new 3level domain.

Any help are appreciated.

Thanks,

Best Answer

Assuming you know the subdomains that your customers are using, you should just setup DNS entries for each of them, pointing at the DC they each should be using. A lot of DNS providers these days have HTTP-based "APIs" or varying quality which you can use to automatically update DNS records when your provisioning database gets updated (create customer record -> create DNS record; cancel customer -> delete DNS record). If you're hosting DNS yourself, you can easily script something to generate the DNS zone data from your customer records.

DNS wildcards are evil, confusing, and don't do what you probably think they do. I strongly recommend you stop using them and never let them darken your door ever again.