I want to specify from the beginning that this is among my first times trying to configure servers and domains, so don’t be too hard on me, I need a little guidance after searching for solutions on the internet for about 3-4 hours.
The problem is as follows: on the registrar I have bought my domain from you are allowed to add a maximum of 6 DNS servers per domain. The mail server I use asked me to add 3 DNS servers to the nameservers. The AWS instance has 4 DNS servers to add. As I said above, the registrar allows me to add 6 (I currently need 7).
Ideally, in the future, I would like to have subdomains for my domain (such as dev.domain.com for dev env, stage.domain.com for stage env, www.domain.com for prod). As far as I know (probably wrong in some way), each subdomain should be connected to a separate AWS instance (3 in total – dev, stage, prod), which would mean that 3 separate IPs should be mapped for each subdomain, so I would need to add about 12 more DNS servers to add to the registrar.
How could I solve this? I’m sure I’m missing something and I don’t know what.
I wrote an email to the registrar support and apparently 6 is a standard maximum number of DNS servers that you can add per domain.
2
Answers
It seems like there is some confusion between DNS servers (nameservers) and DNS records. You don’t need to add separate DNS servers for each subdomain or AWS instance. Instead, you need to create DNS records that point to the IP addresses of your instances.
Nameservers from the mail server and nameservers from AWS should go as 2 separate NS records. So you won’t reach a limit of 6 nameservers per NS record.
You’ll create an NS record for the mail server (3 records) and another NS server for AWS (4 records). Mail server NS records are usually set up to a different domain like mail.example.com.
You can create subdomains by adding DNS records (A records or CNAME records) in your DNS management panel, not by adding more DNS servers.
As for subdomains for staging/prod. Assuming you’ve added AWS nameservers to your DNS provider, you can now add subdomains on AWS:
Create a Route53 hosted zone for your subdomain
In the hosted zone, create A records for each of your subdomains (dev, stage, and www) and point them to the respective IP addresses of your AWS instances. For example:
You’ll set up A records if you point them to AWS resources and not IP addresses (like Cloudfront, load balancer) – but that’s the scope of another question.
Remember, you’re creating DNS records, not adding more DNS servers.
Are you talking about NS servers?
If this is the case one quick thing you can do is:
https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingHostedZone.html
Now you can manage DNS registers from AWS Route53 and you don’t need to make any changes in your registrar’s DNS configuration.
Regards