I'm trying to find a load balancer that has a Name
tag with some value.
aws elb describe-load-balancers --query 'LoadBalancerDescriptions[*].LoadBalancerName'
I'm iterating over the results and running:
aws elb describe-tags \
--load-balancer-names some-load-balancer \
--query 'TagDescriptions[?Tags[?Key==`Name`].Value == `my-desired-name-value`]'
The result is always empty even though this:
aws elb describe-tags \
--load-balancer-names some-load-balancer \
--query 'TagDescriptions[].Tags[?Key==`Name`].Value'
Does return my-desired-name-value
.
I'd like to get the entire object of the tags, using only JMESPath, I can't use jq
here.
Desired output:
{
"TagDescriptions": [
{
"LoadBalancerName": "some-load-balancer",
"Tags": [
{
"Key": "SomeTag",
"Value": "SomeValue"
},
{
"Key": "Name",
"Value": "my-desired-name-value"
}
]
}
]
}
What's wrong with my JMESPath query?