# Retrieve EC2 Tags via Ansible

**URL:** <https://forum.ansible.com/t/retrieve-ec2-tags-via-ansible/26937>\
**Category:** Ansible Project\
**Created:** [March 8, 2018, 3:35pm UTC](https://forum.ansible.com/t/retrieve-ec2-tags-via-ansible/26937 "2018-03-08T15:35:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anurag\_Sernapally](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@Anurag\_Sernapally](https://forum.ansible.com/u/Anurag_Sernapally)\
**Post date:** [March 8, 2018, 3:35pm UTC](https://forum.ansible.com/t/retrieve-ec2-tags-via-ansible/26937/1 "2018-03-08T15:35:51Z")

</div>

Hi All,

I have an requirement to execute specific ansible task based on the ec2 tags thats been injected in the instance. I am using ansible version 2.2.

Can someone let me know how can I get the list of ec2 tags? Below is the code snippet that I am trying to execute.

Code:
