简体   繁体   中英

AWS-CLI: How do I filter autoscalinggroups

Unable to find example to use filters https://docs.aws.amazon.com/cli/latest/reference/autoscaling/describe-auto-scaling-groups.html#options

Try with the following command:

aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?contains(Tags[?Key==`eks:nodegroup-name`].Value, `cassandra`)]' --region [AWS_REGION]

Or if you only want the ASG name you can filter it using:

aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?contains(Tags[?Key==`eks:nodegroup-name`].Value, `cassandra`)].[AutoScalingGroupName]' --region [AWS_REGION]

Reference:

Filtering AWS CLI output

Try something like:

aws ec2 describe-instances --filters "Name=tag:Name,Values=xxx" "Name=tag:env,Values=dev"

more

I tried the same without double quotes with the filters, and it worked.

aws autoscaling describe-auto-scaling-groups --filters Name=tag:\eks:nodegroup-name\,Values=cassandra

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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