如何使用标签和值过滤 AWS 实例boto3
?
import boto3
ec2 = boto3.resource('ec2')
client = boto3.client('ec2')
response = client.describe_tags(
Filters=[{'Key': 'Owner', 'Value': '[email protected] /cdn-cgi/l/email-protection'}])
print(response)
您使用了错误的 API。使用描述实例 http://boto3.readthedocs.io/en/latest/reference/services/ec2.html#EC2.Client.describe_instances
import boto3
client = boto3.client('ec2')
custom_filter = [{
'Name':'tag:Owner',
'Values': ['[email protected] /cdn-cgi/l/email-protection']}]
response = client.describe_instances(Filters=custom_filter)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)