【问题标题】:how to know at what date time my ebs volume got unattached如何知道我的 ebs 卷在什么日期未连接
【发布时间】:2022-11-08 01:29:22
【问题描述】:

仅当上周未附加 ebs 时,我才必须删除未附加的 ebs 卷。 为此,我需要找到与 ec2 未连接的 ebs 的确切日期和时间。

【问题讨论】:

  • 检查 CloudTrial 以获取该信息。
  • 我需要使用 python boto3 来完成这一切
  • 是的,如果您启用了 CloudTrail Trails,您可以使用 python 查询 CloudTrail。
  • 或者,查询 AWS Config(如果您激活了 Recorder)。

标签: python amazon-web-services amazon-ec2 boto3


【解决方案1】:

有两种方法可以实现这一点- 手动 - 使用 AWS cloudtrail 查找事件并从事件中获取时间戳。手动删除资源。

自动 - 创建一个脚本,可能使用 python boto3 查找未附加的 ebs 1 周并删除。要么使用 Lambda 安排它,要么将其作为 cron 添加到任何有权访问所需 aws 资源的服务器中。

【讨论】:

    猜你喜欢
    • 2013-12-05
    • 1970-01-01
    • 2014-05-14
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    • 1970-01-01
    • 2020-03-13
    • 2016-08-12
    相关资源
    最近更新 更多