hands on Google DNS

A normal day I was under the protection of my headphones thinking about some ideas like kubernetes clusters, continuous integration, continuous deployment was when I received the mission: We could migrate to Google DNS!
Almost instantly I started thinking about my requirements for this migration:

* Create an Infrastructure as a code

* Document all zones and records

* Easy reproducibility

With my requirements in the mind I thought: I need create a tool to make this communication between my DNS data and Google DNS.
That’s when I looked at the Google DNS API and realized that Python 3 was supported by the libraries that allowed this connection, this can be a lot of fun. I began to think about how tedious it was to read configuration files from the zones and how terrible that would be for an API communication. The data structure is one of the subjects that I never tire of studying.
Solutions such as NoSQL database have shown us the power that a JSON file with a simple key and value can have in storing and fetching data.
So I came up with the idea to solve the first two requirements of my mission: I can create the provisioning to Google DNS using the API. I can along with zones files have a versioning documented about what that was provisioned. In the future I can create the job in Jenkins to trigger any changes to master branch and provisioning a new records.

"zone": "example.com.",
"name": "name-of-your-zone-in-google-cloud-dns",
"description": "
example of DNS zone writed in JSON format",
"records": [
"name": "example.com.",
"type": "A",
"ttl": 3600,
"value": ["",
"name": "dns.example.com.",
"type": "CNAME",
"ttl": 3600,
"value": ["google.com."]

To reproduce with ease the tool should be able to run as in command line. The life can always be more fun when use Python 3.
I created open source tool shared below. I hope that if you have read so far it means that have a chance to receive a star in this repository, maybe adding feature, complain about some issue, please enjoy.




Making the difference via open source

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Marcelo Barbosa

Marcelo Barbosa

Making the difference via open source

More from Medium

5GC deployment on AWS Cloud

The trend of deploying core network on cloud

Installing and using JetBrain — TeamCity on GCP — Google Cloud Platform

Monitoring Nginx Rate Limiting

Elegy to Cloud Monitoring