Is there a way to auto-add(/delete/change) droplets to DNS?

July 5, 2015 1.1k views
DNS API

I have my domain's name servers set to be DO's name servers. I can successfully manually add/delete records in the DO control panel, but it would be super-cool & useful for the droplets to "auto-register" themselves (create A records) in DNS for a given domain (simple for me, I only have one, but I can see folks having multiple ones) and auto-remove themselves when I destroy the droplets. I have been doing rapid prototyping and am creating sets of droplets, using them for a few minutes, and then destroying them. Each time I create a round I have to go in and re-set the DNS A rec's for the new droplets (they tend to get the same IP addresses, but the IP mappings change between droplets that are named the same as the last round...) Is auto-mapping available today (thru the UI) or if not, is it possible thru the API (I guess I'd have to write a program to do the mapping/unmapping when I create/destroy respectively...)

1 Answer

It most certainly is possible to do this through the API. I would suggest downloading a wrapper for your language of choice, or even just execue a cURL request, and then adding the DNS modifications you like to be completed during your create/destroy process.

See: https://developers.digitalocean.com/documentation/v2/#create-a-new-domain-record

Have another answer? Share your knowledge.