I have read some of the AWS documents but could not find an exact answer. I am looking to have different domains resolving internally inside the same VPC.
Something like this:
domain1.internal (dns zone Z1)
domain2.internal (dns zone Z2)
Both domains would obviously resolve hosts in the same ip ranges.
Is this possible in AWS and are any potential clashes or pitfalls having this configuration?
Or should I have a single private DNS zone instead as below?
subdomain1.domain.internal
subdomain2.domain.internal
CodePudding user response:
By default AWS uses Route 53 for domain resolution. Route 53 provides Private Hosted Zones for internal domains. Private Hosted Zones are tied to VPCs, so they they will resolve domains in the same CIDR ranges.
When you create a Private Hosted Zone, you specify a parent domain. Each hosted zone can have different type of records. NS records are generated by AWS, you don't have to create them manually. In case of other records:
- You can have an
A
record, which can be either Alias or non-Alias. This can be the same as the domain name of the hosted zone; - You can multiple
CNAME
records or 'A' records for your subdomains; - You can have other records, for other purposes (see record types )
In your case if we take subdomain1.domain.internal
and subdomain2.domain.internal
:
- You can have
domain.internal
as the parent record for the hosted zone and create 2CNAME
orA
records forsubdomain1
andsubdomain2
- Or you can create separate hosted zones for
subdomain1.domain.internal
andsubdomain2.domain.internal
and useA
records
The downfall of the first approach is that your hosted zones wont be as granular, meaning that everything which ends with domain.internal
will be resolved with this hosted zone. You can override this, by creating other hosted zones with more precise parent domain names (see overlapping namespaces).
The downfall of the second approach is that you will pay for each hosted zone. Private Hosted Zones are relatively cheap.