Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Script-01

Anyone with a script to retrieve compute engine details (PROJECT NAME, INSTANCE NAME , ZONE , NETWORK , SUB-NETWORK , PRIVATE-IP, PUBLIC-IP") will be appreciated

0 1 95
1 REPLY 1

This is one approach, that captures the primary interface (it doesn't have the project name, but you can easily derive that):

gcloud compute instances list --format="csv(name,zone,networkInterfaces[0].network,networkInterfaces[0].subnetwork,networkInterfaces[0].networkIP,networkInterfaces[0].accessConfigs[0].natIP)"

Take a look at this documentation for more details on formatting gcloud output:

https://cloud.google.com/sdk/gcloud/reference/topic/formats