# Use Variables as dynamic Alias

**URL:** <https://community.grafana.com/t/use-variables-as-dynamic-alias/15345>\
**Category:** Grafana\
**Created:** [March 14, 2019, 3:54pm UTC](https://community.grafana.com/t/use-variables-as-dynamic-alias/15345 "2019-03-14T15:54:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![noskills84](https://avatars.discourse-cdn.com/v4/letter/n/82dd89/32.png) [@noskills84](https://community.grafana.com/u/noskills84)\
**Post date:** [March 14, 2019, 3:54pm UTC](https://community.grafana.com/t/use-variables-as-dynamic-alias/15345/1 "2019-03-14T15:54:14Z")

</div>

I’m using the cloudwatch plugin and trying to display multiple CPU graphs for a specific tag. I can get it to work but the names aren’t useful as it’s just the IDs.  
My two variables are:  
$InstanceId - ec2\_instance\_attribute(us-west-1, InstanceId, { “tag:CustomerName”: [“MyCustomer”] })

$InstanceName - ec2\_instance\_attribute(us-west-1, Tags.Name, { “instance-id” : [“$InstanceId”] })

This works, I can get $InstanceName back for a single Variable. And I can get it to display one or more of my instances in a graph for my tag.

 ![image](https://us1.discourse-cdn.com/grafana/original/2X/6/61239d8a3afbbfe6385da6b029bd5d6ada889c81.png)

But as you can see is the alias needs to be changed to {{InstanceId}} to get anything but CPUUtilization for the legend. What I want is to use $InstanceName and replace the InstanceIds but I can’t figure out how to get it to work.

FYI if I reverse the name and IDs as variables I can’t get the multi-select to work.

Thanks for any help!
