2

I manually update the DNS settings at the registrar for my domains, such as

https://domains.google.com/registrar

What are people using to automate updates to DNS settings? which registrars have an API ?

Specifically I need to manually update :

  • TXT field for the DKIM setting

  • TXT field for spf

    @ TXT 1m "v=spf1 ip4:100.22.22.100 include:blah.com -all"

  • A record everytime I change external IP

To run my own DNS host servers seems like overkill. Ideally I would just make some secure REST call to perform programmatic updates.

2 Answers 2

1

Amazon web services provides such a service, called Route53. You can actually use REST calls, but it is much easier to use their command line tools or bindings for PHP, Python or JavaScript.

Here is an entry point to get you started, the route53 change resource record sets call can be used to update or insert one or many records on a domain. https://docs.aws.amazon.com/cli/latest/reference/route53/change-resource-record-sets.html

Of course you need to create an account, set up permissions and delegate name servers to route53.

It's also not free, but fairly cheap at $0.50 for first 25 domains, then $0.10 after. All charges per month.

2
  • You can use CNAME for that DKIM record so you only need (and pay for) one domain (zone) in AWS Route 53 where the TXT records will be managed and use CNAMEs to point to those records from the "business" domains.
    – Messa
    Commented Aug 14, 2018 at 1:25
  • For example here is the Python API (library called boto3) for AWS: boto3.readthedocs.io/en/latest/reference/services/route53.html
    – Messa
    Commented Aug 14, 2018 at 1:26
1

You can use dns.resolver or dns.rdatatype and update in Python like below:

import dns.resolver
import dns.rdatatype
import dns.update

for i in dns.resolver.query('blah.com', 'TXT').answer.response:
   update.replace(% i , 60, dns.rdatatype.TXT, '" NEW RECORD"')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.