简体   繁体   English

如何使用boto3在一个describe_ [resource]中制作多重过滤器?

[英]How to make multiples filters in one describe_[resource] with boto3?

is possible make something like the example to get one sg from an specific vpc?: 是否有可能像例子一样从特定的vpc中获取一个sg?

sgs = client.describe_security_groups(
    Filters=[
        {'Name': 'vpc-id', 'Values': ['vpc-1111111']},
        {'Name': 'GroupName': 'Values': ['sg_name']}
    ]
)

I'm not sure I understand your question but if you want to filter the results based on both a vpc-id and the name of a group, you would do this: 我不确定我是否理解您的问题,但是如果您想同时基于vpc-id和组名来过滤结果,则可以执行以下操作:

sgs = client.describe_security_groups(
          Filters=[{'Name': 'vpc-id', 'Values': ['vpc-11111111']},
                   {'Name': 'group-name', 'Values': ['sg-name']}])

Does that help? 有帮助吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM