0

I am generating zone files for the route-53 hosted zones using boto3 and dnspython library.I am succesfully able to generate A/CNAME/MX/TXT Record Sets using dnspython library(1.14.0). However ,since it does not have any implementation of ALIAS TARGET (A Record).I am getting this error:

**Traceback (most recent call last):
  File "/home/work/dns_check.py", line 156, in <module>
  rdataset = add_record_type_A(zone, name, address)
  File "/home/work/dns_check.py", line 28, in add_record_type_A
  rdata = rd_A.A(IN, A, address=address)
  File "/usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/A.py", line 34, in __init__
  dns.ipv4.inet_aton(address)
  File "/usr/local/lib/python2.7/dist-packages/dns/ipv4.py", line 51, in inet_aton
  raise dns.exception.SyntaxError
  dns.exception.SyntaxError: Text input is malformed.**

It is because ALIAS is like "alias.testdomain.com" which is not a IPV4 supportive. I am able to generate it by editing the python library.Is there any other way around?

Thanks in advance

tom
  • 3,720
  • 5
  • 26
  • 48

1 Answers1

0

You are right that the AWS "Alias" record is not a standard DNS record type.

If you are trying to generate a plain standard DNS zone file using records in the Route53 hosted zone, the closest standard record type would be a CNAME record. However, your generated zone file will not behave exactly the same way as the Route53 zone because the "Alias" record returns the A records of the target when queried live, whereas your generated zone file gives a CNAME record, which the resolver goes off and do another round of queries to eventually get the A records.

There is also a caveat that per the RFC1033, a CNAME record cannot be used with other record types. This usually causes troubles if you have an Alias record for the root of your domain, i.e. testdomain.com, which should not have CNAME records because it already has SOA, NS and possibly MX and other records.

Wil Tan
  • 701
  • 3
  • 4
  • Yes,Exactly ,so currently what I am handling now is - If record set type is ALIAS then I am appending into an array and at last appended it(ALIAS) to that file in a standard way. – tom Jul 26 '16 at 06:01