https://github.com/micromaomao/cloud-vm-dns-sync
A small go script to automatically add Cloudflare DNS records for gcp cloud servers.
https://github.com/micromaomao/cloud-vm-dns-sync
Last synced: about 2 months ago
JSON representation
A small go script to automatically add Cloudflare DNS records for gcp cloud servers.
- Host: GitHub
- URL: https://github.com/micromaomao/cloud-vm-dns-sync
- Owner: micromaomao
- License: mit
- Created: 2021-01-09T19:42:05.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-18T18:48:53.000Z (over 3 years ago)
- Last Synced: 2025-01-30T09:22:54.666Z (4 months ago)
- Language: Go
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Function
This script does the following for each of your GCP Compute instances:
1. Get the PTR record configuration (in network interface tab)
2. Get its current IP, or nothing if it is powered off.
3. Create the corrosponding DNS records in your cloudflare zone based on the domain name in the PTR, and the IP of the instance, or delete the record if the machine is off.## Usage
1. Create a file named something like `cloudflare-cred.ini`, and populate it with the following:
dns_cloudflare_api_token = your cloudflare API token2. Create a service account with the "Compute Viewer" role, and download their GCP credential to a JSON file.
3. Run the script with the following environment variables:
CLOUDFLARE_INI=location of the file created in step 1
GOOGLE_APPLICATION_CREDENTIALS=location of the file created in step 2