# Unable to assign instance ID to a variable

**URL:** <https://forum.ansible.com/t/unable-to-assign-instance-id-to-a-variable/22274>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [August 11, 2016, 3:31pm UTC](https://forum.ansible.com/t/unable-to-assign-instance-id-to-a-variable/22274 "2016-08-11T15:31:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AC11](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@AC11](https://forum.ansible.com/u/AC11)\
**Post date:** [August 11, 2016, 3:31pm UTC](https://forum.ansible.com/t/unable-to-assign-instance-id-to-a-variable/22274/1 "2016-08-11T15:31:21Z")

</div>

Hi,

I am using ansible to get the instance ID of a EC2 instance on AWS through the use of ec2\_remote\_facts.  
How do I assign the instance ID to a variable using set\_fact?

I was trying to use the following script but it did not work.

`
