问题描述
我过去曾使用 boto3 查找所有非公开
的图像,以便将我返回的图像列表从数千个减少到一个可管理的数量.
I have used boto3 in the past to find all images which were not public
, so as to decrease my list of returned images from the thousands to a manageable number.
但是,我不知道如何以这种方式过滤 EBS 快照.我已经尝试了以下
However, I can not work out how to filter EBS snapshots in this fashion.I have tried the following
ec2.describe_snapshots(OwnerIds=self)
然而,OwnerIds 只需要一个 Id 列表.
However, OwnerIds only takes a list of Ids.
我一直在阅读以下文档:describe_snapshots,并指出
I have been reading the following documentation: describe_snapshots, and it states that
结果可以包括指定所有者的 AWS 账户 ID,amazon 用于亚马逊拥有的快照,或 self 用于您的快照自己的
但我不知道这个 self
打算去哪里.有人可以帮忙吗?谢谢.
but I can not work out where this self
is meant to go.Can anybody help? Thanks.
推荐答案
尝试:
client.describe_snapshots(OwnerIds=['self'])
或者您可以指定您的帐号/ID:
or you can specify your account number/id:
client.describe_snapshots(OwnerIds=['123456736123'])
两者是等价的.
这篇关于如何使用 boto3 获取我拥有的 EBS 快照列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!