我想通过使用Boto3的域名和域名服务器过滤DHCP选项集。文档声明我可以使用几个过滤器。https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#dhcpoptions
看起来我应该能够使用一个“键”过滤器来过滤域名。
“键--其中一个选项的键(例如,域名)。”
下面的代码会产生错误。
def query_dhcp_options_set():
ec2_client = boto3.client('ec2', region_name='us-west-1')
filters = [
{'Name':'domain-name', 'Values':['example.com']},
]
return ec2_client.describe_dhcp_options(Filters=filters)botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the DescribeDhcpOptions operation: The filter 'domain-name' is invalid
我还尝试了以下代码
def query_dhcp_options_set():
ec2_client = boto3.client('ec2', region_name='us-west-1')
filters = [
{'Name':'key:domain-name', 'Values':['example.com']},
]
return ec2_client.describe_dhcp_options(Filters=filters)botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the DescribeDhcpOptions operation: The filter 'key:domain-name' is invalid
可以通过域名和域名服务器属性提供查询DHCP选项集的示例吗?
发布于 2022-02-24 19:50:33
试试[ { "Name":"key", "Values":[ "domain-name" ] }, { "Name":"value", "Values":[ "example.com" ] } ]
https://stackoverflow.com/questions/71256126
复制相似问题