Search code examples
amazon-web-servicesaws-resource-group

Only get existing resources with ResourceGroupTaggingAPI


I am using the AWS ResourceGroupTagginApi (the get-resources command, https://docs.aws.amazon.com/cli/latest/reference/resourcegroupstaggingapi/get-resources.html) to list all my resources in my account and check if the tags are setup as I want to.

No I notice that the get-resources command also returns resources, that I have already deleted.

The advantage of the ResourceGroupTagginApi for me is, that I can get all resources and there tags using one command, and I don't have to call the service specific apis (which I would have to implement for every service separately).

How can I only return resources that have not been deleted? Or how can I filter the resources out, that have already been deleted without using the service specific APIs?


Solution

  • I wanted to do this and couldn't find a way to do it. As my employer has an AWS support contract I raised a ticket for this; the important bit of the response was:

    Please note that, currently, this is a known issue with Resource Groups Tagging, where the stale/deleted resource tags are still being returned when calling get-resources. I have added your case to the known issue to better prioritize the development.

    so hopefully this may get fixed in the future.