我需要实际删除具有tags_description的特定快照。我使用以下代码:
def call_cleaner(data):
regions = ['us-west-2', 'eu-central-1', 'ap-southeast-1']
for index, region in enumerate(regions):
for ip_address, tags_descrip, regions_az, volume_id in data[index]:
client = boto3.client('ec2',region,aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY)
delete_snapshot = client.describe_snapshots(Filters=[{'Name': 'tag-value', 'Values':[tags_descrip]}])
for snap in delete_snapshot['Snapshots']:
print snap
# print "Deleting snapshot %s" % snap['SnapshotId']
# ec2.delete_snapshot(SnapshotId=snap['SnapshotId'])
但此代码无法过滤掉我有兴趣删除的任何快照。事实上它并没有打印任何东西。我虽然在我的帐户上有tags_descrip的快照。请帮忙