【问题标题】:Is there a way to tell who started an instance in Google Cloud Platform?有没有办法知道谁在 Google Cloud Platform 中启动了一个实例?
【发布时间】:2018-03-03 01:15:15
【问题描述】:

我们只在 Google Cloud Platform 上运行少数几个实例,并且不会一直运行它们。通常我们只是启动一个,做我们需要做的然后关闭它......这很好,除非“我们”忘记关闭它们。

我已经能够找到相关的REST APIsgcloud sdk,但我没有看到任何说明谁启动了该实例。实际上,它也没有启动时间的时间戳。

我确实找到了this python 应用程序引擎脚本,我可以重写它以在 X 时间后停止实例,但我宁愿找到一种方法来通知启动它的用户并让他们知道实例仍在运行。

有没有人尝试做类似的事情或看到了一种在 GCP 中获取实例“启动器”的方法?

【问题讨论】:

    标签: google-cloud-platform google-compute-engine google-cloud-stackdriver


    【解决方案1】:

    您可以查看Audit Logs 以确定谁在何时何地做了什么。此外,您可以针对您的用例使用 Stackdriver Logging API 方法 entries.list 到 retrieve audit log entries

    您也可以选择使用Activity Logs来了解发起API请求的授权用户等详细信息。

    【讨论】:

    • 甜蜜。通过这些链接,我能够构建这个 gcloud 命令:gcloud logging read "resource.type = gce_instance AND jsonPayload.event_subtype = compute.instances.start"。谢谢!
    猜你喜欢
    • 2019-06-29
    • 1970-01-01
    • 1970-01-01
    • 2010-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多