通过'tag:component'过滤boto实例列表:'foo'或'tag:component':'bar'

J0h*_*4lt 7 boto amazon-web-services

我想在boto中获得一个实例列表,或者有一个foo或bar的"component"标签.

有没有办法避免发出两个请求并重置对象?

gar*_*aat 13

这应该找到所有具有component值为或者调用的标记的实例foo或bar:

import boto.ec2
c = boto.ec2.connect_to_region('us-west-2')
reservations = c.get_all_instances(filters={'tag:component':['foo', 'bar']})
Run Code Online (Sandbox Code Playgroud)

这会解决你的问题吗?