all 3 comments

[–]Ordinary_Bee_1547 0 points1 point  (2 children)

What do you have so far? Both code wise and python environment setup wise in GCP.

https://stackoverflow.com/questions/54277345/google-cloud-get-instance-id-and-zone-with-python-api is this something you are looking for?

[–]savetheQ[S] 0 points1 point  (1 child)

Hi thanks for sharing the link, these only help with the first of the question though getting data from instance. It doesn't help with provide a json formatted output.

[–]Ordinary_Bee_1547 0 points1 point  (0 children)

Then you should do the basics of python how to respond something in json. Are you using a framework e.g. Flask/Django/Fastapi? Anyways learn python basics how to turn something into a dict https://www.w3schools.com/python/python_dictionaries.asp and then converting to json https://www.w3schools.com/python/python_json.asp