Route 53 forward inbound to local homelab

I’m just really getting into AWS after years of occasionally spinning up an EC2 instance or so. I’ll be taking the exam for the Cloud Practitioner cert in a couple weeks!

So I have a local homelab that runs many different webapps. I have registered a domain with Route 53. I want some addresses like blah.blahblah.com to go to EC2 instances while others like blah2.blahblah.com to be forwarded to my homelab. What’s the best way to go about this, or any resources I can read to be more familiar?


Related discussions:

Just put the A record for Blah2 pointing to your IP address.

Make sure your router has a a NAT to go to your web server.

I think there is a distinction between the domain that points at the homelab and the domain that points at EC2 instances: EC2 instances will probably come and go, but the homelab will run continuously (or, at least, won’t be getting new IP addresses).

For the homelab case, I wrote a python script to do this. You can discover your own IP address and use the boto library to go update route53. My script is here in case anyone wants to have a look: https://github.com/mjkelly/experiments/blob/master/dns/route53-update2.py

For EC2 instances, I’d use whatever automation you use to start them to also update DNS: start instance, get IP address, update r53. If you’re not using automation yet, start using the CLI and put that command in a shell script — boom, there’s your automation :wink:

There may be tools to do this, but especially if you’re in learning mode, writing these things yourself is a nice practical exercise.

Route53 is just a dns service. It’s got some nice features if you’re pointing to other AWS resources, but as for your home lab, it’s no different than GoDaddy or whatever dns provider you’re used to.

You want “A” Records in the hosted zone pointing to the public IPs of your servers. If they’re all at the same IP… then it gets a little complicated and you‘ll want to look in to setting up a “reverse proxy” on your lab network.

use a wildcard with dynamic dns to your home IP and then just set records for other stuff as you need (they take priority) – I use this: https://github.com/XertroV/aws-dyndns (pure aws)

then use a reverse proxy or whatever to route from there.

Many homelabs don’t have a stable IP

Other comments address the automation though

The most convenient (but not cheapest/simplest) solution may be to setup up a site-to-site VPN tunnel between your home lab and your VPC. You can then forward connections from ALB/NLBs configured in your VPC directly to the internal IP of those services in your home lab, without having to worry about exposing potentially insecure endpoints externally on your home network. One downside is that if your external IP changes frequently, you’ll have to update the connection settings often, which might make it less convenient. Thanks to the routing featues of the ALB, you could host multiple endpoints on a single load balancer, directing traffic to different EC2 instances or your home network, and this would be invisible to the viewer.

Yeah I pay extra for a static IP, but I understand some are dynamic.

If your router supports something like FreeDNS or No-IP you can create a domain there your home router auto-updates then create CNAME records in Route53. This may or may-not be easier than running an aws-route53 updater at home