Create your own Dynamic DNS for free (almost) with Docker and AWS

Do you use free Dynamic DNS (DDNS) services like and you feel frustrated for having to confirm your hostname every month to keep your account alive? Additionally, you have your own custom domain which you already use on your website/blog, and you think you could also use it for DDNS? You are in the right place.


  • You own a custom domain like
  • You have some kind of hardware plugged in 24/7 at home (i.e. in your DDNS place)
  • Few minutes to configure the whole environment :)

Install Docker on your hardware

Here there are different variations depending on your hardware. If your “24/7 hardware” is a PC with Windows/macOS, you should install Docker Desktop. However, if you have a linux system such as a server or an IoT device like a Raspberry Pi, you should install the Docker engine (and docker-compose) package. I leave here few hints:

  • In Ubuntu, it’s included in the official repository: $ sudo apt-get install docker-compose
  • For Raspberry Pi Raspbian, I recommend this tutorial.

Setup your domain DNS in AWS Route 53

If you don’t have an AWS account, create yours here. You’ll have access to few services for free for 12 months — check here the full list of the included products in the free tier. However, Route 53 is not included. You’ll pay $0.50 per hosted zone per month ($6 annualy), that it’s quite cheap :)

With your AWS account make Route 53 the DNS service for the custom domain you use. For this step, you can follow the instructions in this post of the AWS documentation. In the end you could also optionally transfer registration for the domain to Route 53, so your domain registration would be managed by AWS too. This is not required for this tutorial though, you only need to have the DNS service in Route 53.

At this point you should have a hosted zone in AWS Route 53 with your custom domain and all the previous records you were using for your website/blog/email. Now, create a new A record (e.g. with a dummy IP (tip: use the same you have in www A record).

Finally, save the “Hosted zone ID” of your domain. You can look for it in the Route 53 mainpage.

Create a secret key in AWS IAM

You need to create an access key, so the service can update the record with AWS CLI. You can do this in AWS IAM here. Save the Access key ID and the Secret key. Note that you won’t be able to check the Secret key later. If you need to recover it, delete the previous key and create a new one.

Clone the git repository and update the file with AWS variables

On your 24/7 machine, clone the git repository I developed to this tutorial:

$ git clone

Edit the file aws_variables.env and add the correspondent info:

  • The default AWS region in AWS_REGION= , example eu-west-3
  • The Access Key ID in AWS_KEY_ID=
  • The Secret Key in AWS_SECRET_KEY=
  • The Hosted zone ID in AWS_HOSTED_ZONE_ID=
  • The Record name you want to update AWS_RECORD_NAME= , example

Build and run Docker image with DDNS Route53 built-in

And now, the final step, and the easiest one: inside the ddns_aws_route53 repository folder, run:

$ sudo docker-compose up -d


You now have a service running on your hardware which updates the Route 53 record with your Public IP. The service is checking your public IP every minute, and if there is any change to the address, it will update the record. The docker container with the DDNS service will start automatically whenever Docker daemon is started (on boot in linux) or when you start Docker Desktop in Windows/macOS.

Now, take advantage of your new DDNS: access your home network, deploy your private VPN, control your home automation, or host a service on your home server.

If you have any issue, observation or recommendation, please comment. If you find it useful, share this tutorial ;)

Credits for the AWS CLI script:




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Debug Docker builds in Travis CI

httperroryzer: static analysis pass to catch missing returns after http.Error for Go

The journey to be googler day293

While Loops in Swift

Scheduled Horizontal Pod Autoscaler on GKE

SCRUM during COVID lockdown

7 Steps to Build a #RRGGBB Multicolor Lamp (Part 1)

Best of DevOps — May 19th, 2020

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pedro Rito

Pedro Rito

More from Medium

Making automatic backups to the cloud for free

Connecting Visual Studio Code to AWS Lightsail

Kimi no Cloud Services

Sub-domain management in Route53