Dynamic DNS Service
In support of the development of my home lab, I needed a way to connect to my home network remotely. More specifically, I needed to be able to find my home IP address from the public internet. Because Internet Service Providers (ISPs) typically rotate their available IPs between their various clients, a separate system is needed to maintain a public record of the address associated with any given computer.
The application functions as follows: When the computer whose IP is being tracked connects to a certain public endpoint, the IP of this computer is determined. If it has changed since the last time the computer connected, the record of the IP address is updated. By requesting a specific public URL, any third party can be directed to this saved address.
The core logic of the application lives in an AWS Lambda function, written in Typescript. First, the caller IP is extracted from the Forwarded and X-Forwarded-For headers.
For the X-Forwarded-For headers, only the regex changes:
Next, the Lambda looks up the current value using an AWS SDK call:
Finally, the ip can be updated if needed.
In the interest of brevity, much about the infrastructure of this application has been left out. In short, all of the resources accessed by this Lambda, as well as the resources which orchestrate its function, are also defined in code. Read my other posts to find out more about this sort of work.