gpt4 book ai didi

Python 博托 : filter on tag and value

转载 作者:太空宇宙 更新时间:2023-11-03 16:09:12 25 4
gpt4 key购买 nike

按标签键过滤效果很好:

ec2.get_all_instances(filters={'tag-key': 'MachineType'})

如何按键和值进行过滤?

"MachineType=DB"

最佳答案

博托

ec2.get_all_instances(filters={"tag:MachineType" : "DB"})

Boto3

import boto3

ec2 = boto3.resource('ec2')
inst_filter = [{'Name':'tag:MachineType', 'Values':['DB']}]
insts = list(ec2.instances.filter(Filters=inst_filter))
for inst in insts:
print inst.id

关于Python 博托 : filter on tag and value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39431353/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com