我試圖用博託v2.32.0列出在一個特定的ASG標籤AWS博託v2.32.0 - 爲ASG
一些簡單的像這顯然不工作(特別是缺乏一個列表標籤過濾系統):
import boto.ec2.autoscale
asg = boto.ec2.autoscale.connect_to_region('ap-southeast-2')
tags = asg.get_all_tags('asgname')
print tags
或:
asg = boto.ec2.autoscale.connect_to_region('ap-southeast-2')
group = asg.get_all_groups(names='asgname')
tags = asg.get_all_tags(group)
print tags
或:
asg = boto.ec2.autoscale.connect_to_region('ap-southeast-2')
group = asg.get_all_groups(names='asgname')
tags = group.get_all_tags()
print tags
沒有指定'asgname
',它不會返回每個ASG。儘管文檔中提到的有關返回令牌以查看下一頁的內容,但似乎並未正確實施 - 尤其是當每個ASG擁有大量ASG和標記時。
嘗試這樣的事情已經基本上顯示出令牌系統似乎被破壞。它在返回「無」之前並不是「循環」通過所有ASG和標籤:
asg = boto.ec2.autoscale.connect_to_region('ap-southeast-2')
nt = None
while (True):
tags = asg.get_all_tags(next_token=nt)
for t in tags:
if (t.key == "MyTag"):
print t.resource_id
print t.value
if (tags.next_token == None):
break
else:
nt = str(tags.next_token)
有沒有人設法實現這個目標?
感謝
嗨@dcro,我看到,但希望有人可能知道使用由「get_all_tags」返回的列表工作。到目前爲止,我認爲我發現令牌系統並沒有很好地實現。 – jonsnowed 2014-09-23 06:37:05
我根據我的新發現更新了我的問題。希望有人會有一些投入。 – jonsnowed 2014-09-23 06:41:18
對於任何人仍然可以得到這個答案,它仍然沒有實施自v2.35.1,我不得不使用下面接受的aws-cli解決方案。 – WheresWardy 2015-01-15 11:14:49