CloudWatch filtering instances by Tags

Hi,

I’m sorry if this question has already been solved somewhere, but I couldn’t find any suitable solution for this specific issue.

I’m setting-up a custom CloudWatch Dashboard and I would like to repeat a row, based on AWS tags (to isolate my environment’s VMs tagged like “dev”, “prod” ..).

So I have two variables :

 $env_set	ec2_instance_attribute(eu-west-3, Tags.env, {})
 $environment	ec2_instance_attribute(eu-west-3, InstanceId, { "tag:env" : [ "$env_set" ] } )

I set up the row containing my graph query to repeat for every $env_set. It does work only if a unique environment is selected. If I have multiple env, I just have “no data”.
The problem is (or seems to be), the $environment variable doesn’t repeat for every $env_set value.

Here is my query :

To summarize, I would like to dynamically create new rows that contains all my EC2 (and RDS etc..) under the same AWS tage.

Thanks alot for the help.

I"m still looking for an answer to this really

That is a CloudWatch API limitations - can you use CloudWatch API/console to query CloudWatch metrics and filter them by tag? I would say that’s not possible.