Posts Tagged ‘route 53’
Managing Amazon Route 53 with Puppet
This has been sitting in a work dir for a month now. Hopefully posting it motivates me polish it up and release it to the internets.
A while back I got new DSL service at my house in Seattle. In the course of moving I had to reconfigure a few nodes, setup a gateway, etc. And in doing so I discovered that dynamic dns providers totally suck. It’s incredible. $20/year and you can’t even properly do delegations?
Coincidently I also noticed the new hotness from AWS at about the same time. DNS is part of my infrastructure, and puppet manages my infrastructure… So time to make puppet manage my DNS. After an evening hacking this up I present The AWS Route 53 type & provider:
Ensure a record:
tmp donavanm$ sudo puppet apply /tmp/r53.pp notice: /Stage[main]//Route53[foo.strewth.org.]/ensure: created |
Get a list of my current records:
tmp donavanm$ sudo puppet resource route53 route53 { 'foo.strewth.org.': ensure => 'present', value => ['192.168.0.1'], rtype => 'A', zone => 'strewth.org.', ttl => '360' } |
Change ensure => 'absent'
and remove that record:
tmp donavanm$ sudo puppet apply /tmp/r53.pp notice: /Stage[main]//Route53[foo.strewth.org.]/ensure: removed |
And yup, it’s really gone:
tmp donavanm$ sudo puppet resource route53
tmp donavanm$ |
Being a fully functional type and provider it should Just Work in any of the puppet applications. I think the most powerful model would be using something like exported resources with puppet agent and master. The clients would export a resource, like I’ve shown. A trusted master periodically collects and updates all of the entries.
# dynamic clients export their settings class r53::client::dynamic { @@route53 { "${fqdn}.": value => $ipaddress, rtype => 'A', zone => "${domain}.", ttl => '360' } } # A puppet master collects and updates class r53::server::dynamic { Route53 <<| tag == 'r53::client::dynamic' |>> } |
I could see this being a great tool for people with cloudy puppet deployments. Or when you just really want your laptops dns record to be current.
At a dollar a month its half the cost of those dynamic dns guys, totally automated, and a thousand times cooler.