What is Roadworker?
Why we should avoid using Route53’s web console?
Definitely, Amazon Route53 is one of the best DNS hosting service.
- Highly Available
- SLA 100%!!
- basically $0.50 per hosted zone / $0.500 per million queries
- You can start to use within minutes
But Managing Route53 via its web console is slightly painful.
- Not resilient to human error
- Just a single click may delete a important record
- Difficult to review before applying
- No changing histories at all
- After updating many records, it is difficult to revert the original state
Roadworker resolves these issues by defining DNS records as DSL. I’ll show how Roadworker can help you in this article.
Getting Started with Roadworker
Getting started with Roadworker is easy! Open a terminal window and run this command:
$ gem install roadworker
After installing Roadworker, set
AWS_SECRET_ACCESS_KEY for requesting Route53’s APIs.
$ export AWS_ACCESS_KEY_ID='...' $ export AWS_SECRET_ACCESS_KEY='...'
At first, export current records like this:
$ roadwork -e -o Routefile
This is a exported
Routefile. Easy to manage with git or other VCSs, isn’t it?
hosted_zone "takus.me." do rrset "takus.me.", "A" do ttl 3600 resource_records( "220.127.116.11", ) end rrset "takus.me.", "MX" do ttl 3600 resource_records( "10 mail.takus.me", ) end rrset "mail.takus.me.", "A" do ttl 3600 resource_records( "18.104.22.168", ) end rrset "blog.takus.me.", "CNAME" do ttl 3600 resource_records( "takus.github.com", ) end end
As I mentioned above, updating DNS records causes a disaster like deleting unexpected records.
But you can update them safely with
In the case below, I can notice the mistake (deleting the record for this blog) before updating actually.
$ roadwork --apply --dry-run Apply `Routefile` to Route53 (dry-run) Delete ResourceRecordSet: blog.takus.me. CNAME (dry-run) No change
After updating records, you may want to test whether all records are correct state. Roadworker provides
-t option for comparing the results of a query to the DNS and DSL.
$ roadwork -t ....... 7 examples, 0 failure
You should use Roadworker for managing Amazon Route53 records instead of its web console. Roadworker enables us to manage DNS records safely with recording all update histories.