Member-only story

Retrieve Google cloud Network Subnet details across all the projects in an Organization

Rajathithan Rajasekar
2 min readMay 25, 2022

--

Photo by Kelly Sikkema on Unsplash

When you run the below gcloud command to retrieve primary subnet and secondary subnet ranges , it will not display in proper tabular format, meaning not all the rows in the output will have information on region , network , subnet and primary CIDR range, there will be lot of empty column values for the secondary ranges.

gcloud compute networks subnets list-usable

If at all you need this information in proper tabular format, you have to do filter and formats with that gcloud command . This blog post will help you to do that , so you can retrieve the subnets detail not across a single project , but all the projects under your org provided you have access to it.

Create a shell script to iterate through projects and collect the subnetwork data in json format

Iterate through the data using the below python script file and export the details to a csv file.

--

--

Rajathithan Rajasekar
Rajathithan Rajasekar

Written by Rajathithan Rajasekar

I like to write code in Python . Interested in cloud , dataAnalysis, computerVision, ML and deepLearning. https://rajathithanrajasekar.medium.com/membership

No responses yet