Getting AutoScaling Groups using resource_arns

I’m using the CloudWatch datasource and attempting to use the resource_arns query to get a list of autoscaling groups but I can’t seem to get the syntax right.

image

Has anyone successfully done this?

Do you need to use resource_arns and then regexp? Try dimension_values, e.g.:

dimension_values($region, AWS/AutoScaling, GroupTotalInstances, AutoScalingGroupName, [filters])

I’m attempting to use resource_arns because I can then get a list of scaling groups based on a tag.
That way I can get groups that only our team look after, and not all groups in the same account.

Filters are also supported in dimension_values, so you can filter by tag Team.

I tried every syntax I could think of but still couldn’t get it to return any results.

Did you try this syntax?:

dimension_values($region, AWS/AutoScaling, GroupTotalInstances, AutoScalingGroupName,{\"tag:Team\": [\"myteam\"]}

dimension_values($region, AWS/AutoScaling, GroupTotalInstances, AutoScalingGroupName, {"tag:Team": ["myteam"]})

Gives me the error
Template variables could not be initialized: Unexpected token \ in JSON at position 1

dimension_values($region, AWS/AutoScaling, GroupTotalInstances, AutoScalingGroupName, {"tag:Team": ["myteam"]})

Gives me the error
Template variables could not be initialized: e.replace is not a function

I’ve also tried the following but get no results or errors.

dimension_values($region, AWS/AutoScaling, GroupTotalInstances, AutoScalingGroupName, {“tag:Team”: “myteam”})
dimension_values($region, AWS/AutoScaling, GroupTotalInstances, AutoScalingGroupName, {“Team”: [“myteam”]})
dimension_values($region, AWS/AutoScaling, GroupTotalInstances, AutoScalingGroupName, {“Team”: “myteam”})

I’m having this problem as well. Did you ever figure out a solution for looking up an ASG by tag?

Could you please suggest asg with resource_arn

It’s been 2 years since I posted on this, and I’m still not able to get ASGs working. I’m trying to use the resource_arns query feature to get ASGs by tag. I have found other ways that sort of work, but I’d really like to use the resource_arns feature. It will allow me to integrate better with other tools I’m using.
It looks like the grafana interface for this has been updated to make it work better. I’m able to get ec2 instances by tag by specifying “ec2:instance” as the resource type. For ASGs, I’m trying “autoscaling:autoscalinggroup” as the resource type, and I don’t get any results. Is this the wrong resource type? I can’t seem to find any documentation that says what to use.

Ran into the same issue and did a very deep-dive into the code only to find that the issue is with AWS itself.

The resource_arns query uses AWS ResourceTaggingAPI behind the scenes to get the information… and AWS states that ASGs are not supported at this time:

  • The TagResources and UntagResources operations of AWS Resource Groups Tagging API work as documented with Auto Scaling Groups. However, the GetTagKey, GetTagValues and GetResources operations aren’t supported at this time and return an empty response for this service.

Source: Services that support the Resource Groups Tagging API - Resource Groups Tagging API