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

Posted July 5, 2015 2.9k views

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…)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
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.