Reputation: 11
I have attempted and failed so far to achieve the below,
Tags = 1 Values = Multiple (minimum 3) otherwise I could use OR as per example below,
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?contains(Tags[?Key==`marco`].Value,`polo`) || contains(Tags[?Key==`marco`].Value,`bolo`)].[AutoScalingGroupName]'
I've attempted to use https://jmespath.org/proposals/functions.html#contains
Either my syntax is off or the matching criteria isn't correct i.e. won't match against partial values or upper/lower case matters.
The below does not error out but it returns no matches.
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?contains(Tags[?Key==`Marco`].Value, [`polo`, `bolo`, `rolo`])].[AutoScalingGroupName]'
Reference
"Tags": [
{
"ResourceId": "MyASG",
"ResourceType": "auto-scaling-group",
"Key": "marco",
"Value": "polo",
"PropagateAtLaunch": true
}
Goal: There are a large number of ASG and I wish to return the AutoScalingGroupName which will be fed to another step.
Upvotes: 0
Views: 1462
Reputation: 11
With some help and fiddling I ended up with a working result.
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?contains([`Value1`, `Value2`, `Value3`], Tags[?Key==`Keyname`].Value[] | [0])].[AutoScalingGroupName]'
Upvotes: 1