Home servers or AWS Free Tier EC2 instances generally have dynamic IPv4 address. IP address keep changing when we restart our server or automatically after sometimes. In this case, Its not easy to update the DNS record in GoDaddy manually every time IPv4 address changes.
Here we will see steps by steps guide on how can we automate this process using a docker.
Generate GoDaddy API keys
GoDaddy API key and secret must be generated from GoDaddy developer portal.
To generate an API key and secret.
Login to GoDaddy developer portal — https://developer.godaddy.com/
Generate an API key and keep note of it (It won’t display again). Below sample key will be deactivated before this article is published.
Setup
Docker Way (Recommended)
Required tools: Docker
If you have docker installed on your machine. Proceed with these steps.
Pull image
Docker repository: https://hub.docker.com/r/linuxshots/godaddy-ddns
# For amd64 linux
docker pull linuxshots/godaddy-ddns:latest
# For arm64 linux
docker pull linuxshots/godaddy-ddns:arm64v8-linux-1.0.0 # Or any latest available version
2. Run a container using below command. Replace the values with correct value.
For DNS myserver.example.com with ttl 1200 seconds
# For linux running on amd64
docker run --name myserver.example.com -d --restart unless-stopped --env GD_NAME=myserver --env GD_DOMAIN=example.com --env GD_TTL=1200 --env GD_KEY=key-value-from-godaddy-developer-console --env GD_SECRET=secret-key-value-from-godaddy-developer-console linuxshots/godaddy-ddns:latest
# For Linux running on arm64
docker run --name myserver.example.com -d --restart unless-stopped --env GD_NAME=myserver --env GD_DOMAIN=example.com --env GD_TTL=1200 --env GD_KEY=key-value-from-godaddy-developer-console --env GD_SECRET=secret-key-value-from-godaddy-developer-console linuxshots/godaddy-ddns:arm64v8-linux-1.0.0
3. Check the log.
docker logs myserver.example.com
And, You are done.
Make sure to use — restart option while running docker run. This make sure container starts automatically when your machine boots up.
To add another dns for same machine (Max 5 recommended due to rate limitations), Run the same docker run command with another container name and values.
There is also a non-docker way to run GoDaddy DDNS. Visit https://github.com/navilg/godaddy-ddns for detailed steps on that.
Hope this will help setting up your own home server.
Thanks
Linux Shots