There were a lot of topics about this, but I still have a problem with a query.
I used:
aws rds list-tags-for-resource --resource-name arn:aws:rds:eu-west-:xxxxx --query 'TagList[*]'
Output:
{
"Value": "test@test",
"Key": "Owner"
},
{
"Value": "XXXX",
"Key": "Schedule"
}
I need to display only XXXX value. I tried:
aws rds list-tags-for-resource --resource-name arn:aws:rds:eu-west-1:xxxxx --query 'TagList[].Tags[?Key==`Schedule`].Value[]' --output text
but it does not work.
Give a try to this:
aws rds list-tags-for-resource --resource-name arn:aws:rds:eu-west-:xxxxx --query "TagList[?Key=='Schedule'].Value[]"
Also, you may want to use jq:
aws rds list-tags-for-resource --resource-name arn:aws:rds: | jq ".TagList[].Value"
You do not have a nested Tags key inside the TagList list. Filter at the same level:
aws rds list-tags-for-resource \
--resource-name your:arn \
--query 'TagList[?Key==`Schedule`]'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With