Simple yet secure Python script to update DNS record in Google Cloud DNS according to your current IP address.
- Google API Clients &
gcloud
not required - Updates Cloud DNS record using your current IP address
- Uses service account based authentication
This script updates a pre-defined DNS type "A" record in Google Cloud DNS according to the current public IP address of the caller. (i.e. your machine)
When combined with a scheduler, this effectively acts as a Dynamic DNS (DDNS) service for Google Cloud DNS.
- Deploy the Cloud Functions (
/functions
of this repo) and grant it permissions to change Cloud DNS resources. - Create a service account for the script and grant it permission to invoke Cloud Functions.
- Generate a new JSON keyfile of the created service account and store it into your machine.
- Install all necessary python packages (i.e.
pip install -r requirements.txt
)
- Create and fill in the variables required in
.env
file. Refer to.env.template
. python3 main.py
(orpython main.py
if you are usingvirtualenv
)- (optional) Set a crontab to regularly update the DNS record set!