# Can't display Tag Names for hosts in AWX ec2 dynamic source inventory

**URL:** <https://forum.ansible.com/t/cant-display-tag-names-for-hosts-in-awx-ec2-dynamic-source-inventory/33935>\
**Category:** AWX Project\
**Tags:** aws, awx\
**Created:** [October 1, 2020, 3:58am UTC](https://forum.ansible.com/t/cant-display-tag-names-for-hosts-in-awx-ec2-dynamic-source-inventory/33935 "2020-10-01T03:58:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [October 1, 2020, 3:58am UTC](https://forum.ansible.com/t/cant-display-tag-names-for-hosts-in-awx-ec2-dynamic-source-inventory/33935/1 "2020-10-01T03:58:20Z")

</div>

Hi all,

I have my aws\_ec2 iventory config with the bellow setting:

#inventory/infra\_aws\_ec2.yml  
hostnames:

- tag:Name

When I run ansible-inventory I get the desired result, the ec2 instances are displayed with their Name tags:

ansible-inventory -i inventory/infra\_aws\_ec2.yml --graph

@all:

> –@aws\_ec2:
> 
> > –server001.example.com  
> > –@aws\_region\_eu\_west\_1:  
> > –server001.example.com  
> > –@tag\_Name\_server001\_example\_com:  
> > –server001.example.com  
> > –@ungrouped:

In Ansible AWS, under the dynamic inventory source variables, the above setting is not working, I get the imported list of the ec2 instances with their private DNS instead of Name tags…

Can you please advise?

---

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [October 2, 2020, 3:41am UTC](https://forum.ansible.com/t/cant-display-tag-names-for-hosts-in-awx-ec2-dynamic-source-inventory/33935/2 "2020-10-02T03:41:06Z")

</div>

I was able to make it work by setting the bellow in the Dynamic Inventory :

Source Variables:

```auto

hostname_variable: 'tag:Name'

```
