gpt4 book ai didi

python - 如何使用boto3获取我拥有的EBS快照列表?

转载 作者:太空狗 更新时间:2023-10-29 18:28:37 25 4
gpt4 key购买 nike

我过去曾使用 boto3 查找所有非公开的图像,以便将我返回的图像列表从数千个减少到可管理的数量。

但是,我不知道如何以这种方式过滤 EBS 快照。我尝试了以下方法

ec2.describe_snapshots(OwnerIds=self)

但是,OwnerIds 只需要一个 ID 列表。

我一直在阅读以下文档:describe_snapshots , 它指出

The results can include the AWS account IDs of the specified owners, amazon for snapshots owned by Amazon, or self for snapshots that you own

但我不知道这个 self 应该去哪里。有人可以帮忙吗?谢谢。

最佳答案

尝试:

client.describe_snapshots(OwnerIds=['self'])

或者您可以指定您的帐号/id:

client.describe_snapshots(OwnerIds=['123456736123'])

两者是等价的。

关于python - 如何使用boto3获取我拥有的EBS快照列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44573768/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com