# Access host variables from dynamic inventory?

**URL:** <https://forum.ansible.com/t/access-host-variables-from-dynamic-inventory/27973>\
**Category:** AWX Project\
**Tags:** aws, awx\
**Created:** [July 6, 2018, 3:58pm UTC](https://forum.ansible.com/t/access-host-variables-from-dynamic-inventory/27973 "2018-07-06T15:58:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Travis\_Burrell](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@Travis\_Burrell](https://forum.ansible.com/u/Travis_Burrell)\
**Post date:** [July 6, 2018, 3:58pm UTC](https://forum.ansible.com/t/access-host-variables-from-dynamic-inventory/27973/1 "2018-07-06T15:58:01Z")

</div>

AWX 1.0.6.5 Docker image

I’ve got an AWS dynamic inventory established. Each host shows all of the “ec2\_” variables listed [on this page](https://docs.ansible.com/ansible/2.5/user_guide/intro_dynamic_inventory.html) if you look at its page in the UI (Inventories \> Hosts \> \> Details \> Variables listing). Do I need to write a specific “include” statement in my playbook in order to access these variables?

This code:

`

- name: Get our instance info  
ec2\_instance\_facts:  
filters:  
instance-id: “{{ ec2\_id }}”  
register: instance\_info  
`

Results in this error:

`ERROR! Syntax Error while loading YAML. did not find expected key The error appears to have been in '/var/lib/awx/projects/_13__snapshot_testing/standalone/snapshot.yml': line 21, column 8, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: instance-id: "" register: instance_info ^ here`

Which would seem to suggest that the variable isn’t getting set.
