nad87563
nad87563

Reputation: 4072

List untagged resources using AWS CLI

I am not able to get untagged resources using AWS CLI, it works in AWS console tag editor by selecting (not tagged) value from the menu: https://docs.aws.amazon.com/en_us/awsconsolehelpdocs/latest/gsg/find-resources-to-tag.html

However when I issue the following command in CLI, it doesn't work.

aws resourcegroupstaggingapi get-resources --resource-type-filters ec2:instance --tag-filters Key=Owner,Values=not tagged

Error parsing parameter '--tag-filters': Expected: '=', received: 'EOF' for input:
tagged
      ^

aws resourcegroupstaggingapi get-resources --region=us-east-1 --resource-type-filters ec2:instance --tag-filters "Key=Owner,Values=(not tagged)"
{
    "ResourceTagMappingList": []
}

Is this feature only available in aws console tag editor?

Upvotes: 4

Views: 2455

Answers (1)

Parag Wankhade
Parag Wankhade

Reputation: 29

It seems the CLI does not support any fixed value or syntax for "(not tagged)" value. However to filter out the resources not containing the tag you can parse the json response of the cli using a json parser for eg. jq

Upvotes: 2

Related Questions