Simple Python app working "like" DynamicDNS, checks every 15 minutes current public IP address with IP in provided DNS A record and if they are different updates record to the new one. If record doesn't exist yet you have to use create instead of patch method from google-api-python-client package and change app code in main.py a little bit
- Docker installed
- Service account JSON credentials generated in GCP with read/write privileges to Cloud DNS API (replace data in
credentials.jsonfile or change env variableGOOGLE_APPLICATION_CREDENTIALSto new file name)
In Dockerfile you have to change some environment variables to proper ones:
GCP_PROJECT_IDGCP_DNS_ZONEGCP_A_RECORDGOOGLE_APPLICATION_CREDENTIALS
To build docker image:
docker build -t gcp-dns-update .
To run docker container from image:
docker run -itd gcp-dns-update
https://cloud.google.com/dns/docs/reference/v1/
For record set operations: https://cloud.google.com/dns/docs/reference/v1/resourceRecordSets/