Insert Wit Here

Posts Tagged ‘aws

Route53 Latency Based Routing

AWS Route53 launched a new feature today, Latency Based Routing. While playing around with this I created a few bits.

First I set up a t1.micro instance running in each region which will serve you a cat picture. Using a CloudFormation template I created the EC2 instance, downloaded the content from an S3 bucket, setup Apache, created an A record for the host, and another A record encoding the region. Each instance is now directly available via http://<aws region string> Here’s the direct link to west coast cat in us-west-1.

The next step was create an LBR A record of with appropriate RRs for each region. This was done via the AWS console. When entering the IP address the console automatically detected which region the EC2 instance is associated with. Slick!

And now this image comes directly from an AWS region near you:
your fastest cat

LBR isn’t limited to just A records, any record type should work. You could could send Puppet clients to their fastest Puppet Master using LBR SRV records, for example.
To troubleshoot “where am I routed to” questions I created a handy TXT record, This record simply echos back the AWS region it is associated with. For example:

# dig +short txt

LBR is an awesome feature for directing end users to the fastest available dynamic content. I can’t wait to see what people use this for.

Written by donavan

2012/03/21 at 17:26

Posted in Software

Tagged with , ,

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[]/ensure: created

Get a list of my current records:

tmp donavanm$ sudo puppet resource route53
route53 { '':
    ensure => 'present',
    value => [''],
    rtype => 'A',
    zone => '',
    ttl => '360'

Change ensure => 'absent' and remove that record:

tmp donavanm$ sudo puppet apply /tmp/r53.pp 
notice: /Stage[main]//Route53[]/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 { 
            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.

Written by donavan

2011/02/04 at 23:17

Posted in Software

Tagged with , , ,