And you don’t even have to write the script yourself. Depending on your DNS provider, you can probably use https://github.com/qdm12/ddns-updater or something similar to keep it updated.
I personally use it hosted in Docker with Cloudflare on their free plan and it works great. I tried to set it up with Namecheap initially but they have some requirements for API access, some of which include an allowlisted IP address for API clients. I didn’t want to source, configure, and rely on a static IP jump server just for DNS updates, so I changed the DNS provider (but didn’t transfer the domains).
And you don’t even have to write the script yourself. Depending on your DNS provider, you can probably use https://github.com/qdm12/ddns-updater or something similar to keep it updated.
I personally use it hosted in Docker with Cloudflare on their free plan and it works great. I tried to set it up with Namecheap initially but they have some requirements for API access, some of which include an allowlisted IP address for API clients. I didn’t want to source, configure, and rely on a static IP jump server just for DNS updates, so I changed the DNS provider (but didn’t transfer the domains).