Is there a way to tell who started an instance in Google Cloud Platform?

ⅰ亾dé卋堺 提交于 2020-12-15 07:14:39

问题


We run only a small handful of instances on Google Cloud Platform and we don't run them all the time. Generally we just fire one up, do what we need to do then shut it down... which is great, except when "we" forget to shut them down.

I've been able to track down the relevant REST APIs and the gcloud sdk but I don't see anything that says who started the instance. Actually it also doesn't have a timestamp on when it was started.

I did find this python app engine script that I might be able to rewrite to stop the instances after X amount of time, but I'd rather find a way to notify the user who started it and let them know the instance is still running.

Has anyone tried to do something similar or seen a way to get the "starter" of the instance in GCP?


回答1:


You can look into the Audit Logs to determine who did what, where, and when. Further, you can use the Stackdriver Logging API method entries.list to retrieve audit log entries for your use case.

Also you can choose use the Activity Logs to know the details such as the authorized user who made the API request.



来源:https://stackoverflow.com/questions/49055629/is-there-a-way-to-tell-who-started-an-instance-in-google-cloud-platform

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!