Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find who created a GCE VM instance in Google Cloud?

Background

In our current Google Cloud Project it seems it's common that people create a VM, start it, do some of their stuff and then just leave it there without turning it off or deleting the VM.

I'm trying to write an automated script that pulls the list of VM instances every day and send an E-mail to the VM owners and see if they forgot to turn off their VMs.

Question

So is there an easy way to find out who created a GCE VM instance using Google Cloud API?

like image 372
derekhh Avatar asked Oct 17 '25 00:10

derekhh


1 Answers

You can view the information in Stackdriver -> Logging -> Logs. The log is a JSON file, the actor field is what you are looking for. You can export the logs for analysis.

See https://cloud.google.com/logging/docs/

like image 99
Dagang Avatar answered Oct 20 '25 22:10

Dagang