For anyone hosting their domain on Google Domains, there's a neat API endpoint they're offering for updating the DNS with a simple CURL. I've been using this for years now for a public Raspberry PI behind a home router that changes IPs every other day.
Here are the docs: https://support.google.com/domains/answer/6147083?hl=en#zipp...