Unable to find example to use filters https://docs.aws.amazon.com/cli/latest/reference/autoscaling/describe-auto-scaling-groups.html#options
CodePudding user response:
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:
CodePudding user response:
Try something like:
aws ec2 describe-instances --filters "Name=tag:Name,Values=xxx" "Name=tag:env,Values=dev"
UPDATE: I believe you need the tag: or tag-key: per the error message you provided, as in the example above: The filter criteria isn't valid. Valid filter types for the Name attribute of filters are: tag-key, tag-value and tag:<key>. The confusing part is that your tag has the : (COLON) character (more), which either needs escaped or not used or replaced.
aws autoscaling describe-auto-scaling-groups --filters "Name=tag:\"eks:nodegroup-name\",Values=cassandra"
