# How to use information from ec2 facts

**URL:** <https://forum.ansible.com/t/how-to-use-information-from-ec2-facts/20743>\
**Category:** Ansible Project\
**Created:** [March 2, 2016, 3:23am UTC](https://forum.ansible.com/t/how-to-use-information-from-ec2-facts/20743 "2016-03-02T03:23:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adithya\_Khamithkar](https://avatars.discourse-cdn.com/v4/letter/a/e495f1/32.png) [@Adithya\_Khamithkar](https://forum.ansible.com/u/Adithya_Khamithkar)\
**Post date:** [March 2, 2016, 3:23am UTC](https://forum.ansible.com/t/how-to-use-information-from-ec2-facts/20743/1 "2016-03-02T03:23:06Z")

</div>

Hi,

I am using ec2\_remote\_facts to find the ec2 facts of an instance based on the tags.

`

- name: Search ec2  
ec2\_remote\_facts:  
filters:  
“tag:Name”: “{{hostname}}”  
aws\_access\_key: “{{aws\_access\_key}}”  
aws\_secret\_key: “{{aws\_secret\_key}}”  
region: “{{aws\_region}}”  
register: ec2\_info  
`

Now I want to get the instance id of the instance id of that particular host and store it in a variable to use it in my playbook.

Can someone please help in finding or extracting the instance id.

Thanks,
