过滤博托实例列表由'标签:组件':'富',或'标签:组件':'棒'组件、标签、实例、列表

2023-09-11 10:36:14 作者:回头已来不及

我想获得在博托实例列表要么富或酒吧的分量的标签。

I'd like to get a list of instances in boto either have a "component" tag of foo or bar.

有没有一种方法,以避免两个请求,并改写(munging)的对象?

Is there a way to avoid making two requests and munging the objects?

推荐答案

这应该会发现有一个名为标签的所有实例组件,值为任

This should find all instances that have a tag called component with a value of either foo or bar:

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

这是否解决问题了吗?

Does that solve your problem?