So last time I faced Route53 I wasn’t particularly blown away. Luckily someone who can see something I managed to totally miss, @lmzen, left me a lovely comment pointing me in the right directions for a couple of my issues.

By replacing my use of ListHostedZones with the slightly more specific ListHostedZonesByNameRequest the route53.cfc is now able to return the desired hosted zone (or a negative response) far more simply. Not massively important unless you have a lot of hosted zones but I feel better about this method.

But the real game-changer is a lovely method called listResourceRecordSets which, in my desperation, I managed to totally overlook. It, unsurprisingly given the name, returns a list of resource record sets. Wow, sounds like precisely what I was trying to find and failing to last time around!

Long story short after a bit of shuffling around I now have a few more functions to add to my repertoire, so here’s some code samples. It’s probably worth noting that I renamed deleteAliasSubdomain to be deleteSubdomain as it is no longer necessarily restricted to alias records.

// Set up the route53 object
r53 = new aws.route53(
    account = aws_accountid,
    secret = aws_secretkey
);    

// Delete a subdomain
service.deleteSubdomain(
    subdomain = 'lucee-aws.lucee.org'
);

// Check if I have access to a hosted zone for a given domain

service.isThereAHostedZoneForThisDomain(
    domain = 'lucee.org'
); // boolean

// Check if I have access to a resource record for a given subdomain

service.isThereAResourceRecordForThisSubdomain(
    subdomain = 'lucee-aws.lucee.org'
); // boolean

So once again, thank you @lmzen for putting me on the right track. For anyone interested, here is the pull request that has these changes in.

Strayegg

I'm Simon Hooker and have been working as a developer since 2007. I'm currently the Technical Lead at My School Portal. Nowadays I mostly work with NodeJS, Lucee, AWS, and all sorts of other bits and bobs.

Outside of work I enjoy getting out sailing whenever I can (preferably somewhere warm.) I'm a big fan of Terry Pratchetts books. And Lego. I love Lego.

  • Twitter
  • LinkedIn
  • Github
  • Bitbucket
  • stackoverflow