简体   繁体   English

"Boto3:describe_auto_scaling_groups 在输入中给出未知参数:“过滤器”错误"

[英]Boto3:describe_auto_scaling_groups giving Unknown parameter in input: "Filters" error

I'm trying to list a filtered set of ASGs based on Tag value like this:我正在尝试根据标签值列出一组过滤的 ASG,如下所示:

client = boto3.client('autoscaling',region)
asg=client.describe_auto_scaling_groups(
        Filters=[
                {"Name": "tag:ecs_cluster", "Values": ["testCluster"]},
                {"Name": "tag:cluster-name", "Values": ["ciCluster"]}
            ])

This is inline with the Boto3 documentation but on execution it gives the following error:这与 Boto3 文档一致,但在执行时会出现以下错误:

Parameter validation failed: Unknown parameter in input: "Filters", must be one of: AutoScalingGroupNames, NextToken, MaxRecords

How do I get a filtered list without giving any AutoScalingGroupNames?如何在不提供任何 AutoScalingGroupNames 的情况下获得过滤列表?

For anyone stuck with this issue :对于任何坚持这个问题的人:

"Filters" option is a new feature recently introduced. “过滤器”选项是最近推出的一项新功能。 This currently work on latest AWS CLI, I tested as well with latest version and I could confirm it was working.这目前适用于最新的 AWS CLI,我也使用最新版本进行了测试,我可以确认它可以正常工作。

Working version:工作版本:

aws --version
aws-cli/2.4.0 Python/3.8.8 Darwin/19.6.0 exe/x86_64 prompt/off

Other services are still being updated and there is no ETA on when it will be available across all platforms.其他服务仍在更新中,没有关于何时在所有平台上可用的预计时间。 You may use current version of AWS CLI while Lambda is being updated.在更新 Lambda 时,您可以使用当前版本的 AWS CLI。

Well I am having exactly the same error you mention, working fine in a local script but not in lambda, but I would say the real guilty of "filter" not to work is the botocore version on lambda.好吧,我遇到了您提到的完全相同的错误,在本地脚本中可以正常工作,但在 lambda 中却不行,但是我想说“过滤器”不起作用的真正罪魁祸首是 lambda 上的 botocore 版本。

This is the part of the code working fine on local script but NOT working on Lambda:这是在本地脚本上运行良好但不适用于 Lambda 的代码部分:

response = asg.describe_auto_scaling_groups(Filters=[{'Name': 'tag:Patch Group','Values': ['asg',]},],MaxRecords=100) 

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

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