The Amazon Web Services team has a great writeup on Medium about how to roll your own dynamic DNS provider using Route 53. Actually, it uses a smattering of AWS offerings beyond just DNS to offload most of the complexity and just require a simple script on the client side.
In this post, we describe how to build your own dynamic DNS system with a small script and several AWS services. There are other systems that provide similar solutions; however, building a serverless system using nothing but AWS services and a few lines of code is simple, cost-effective, and an example of how to build your own serverless solutions on AWS.
Definitely read their writeup if you have even a remote interest in such things, because it’s very well done and explains the whole idea thoroughly.
To jump to the punchline, the client system must run a simple script that does three things:
- Gets the current IP address
- Builds a URI to update the IP using a shared secret
- Performs an HTTP GET on that URI
That’s all that the client has to do. Obviously, for this to be effective over time, it needs to run on a regular basis so that changes to the client’s IP are reflected in DNS in a timely fashion.
Once you’ve copied their update script onto your VyOS router (and ensured the file is executable), set up a scheduled task to run it periodically:
$ configure # set system task-scheduler task AWS-DDNS executable arguments "your-hostname.dyn.your-domain.com. SHAREDSECRETHERE your-api-endpoint.amazonaws.com/prod" # set system task-scheduler task AWS-DDNS executable path /path/to/your/script.bash # set system task-scheduler task AWS-DDNS interval 5m # commit # save