# cannot access attributes of registered variable returned by AWS CLI command run

**URL:** <https://forum.ansible.com/t/cannot-access-attributes-of-registered-variable-returned-by-aws-cli-command-run/19768>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [November 15, 2015, 11:53am UTC](https://forum.ansible.com/t/cannot-access-attributes-of-registered-variable-returned-by-aws-cli-command-run/19768 "2015-11-15T11:53:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cosbug](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@cosbug](https://forum.ansible.com/u/cosbug)\
**Post date:** [November 15, 2015, 11:53am UTC](https://forum.ansible.com/t/cannot-access-attributes-of-registered-variable-returned-by-aws-cli-command-run/19768/1 "2015-11-15T11:53:59Z")

</div>

Hi All,

I cannot figure out how to reference the zone id attribute from the registered variable of the below AWS CLI.  
For some reason it doesn’t work.

Playbook:

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [November 15, 2015, 3:41pm UTC](https://forum.ansible.com/t/cannot-access-attributes-of-registered-variable-returned-by-aws-cli-command-run/19768/2 "2015-11-15T15:41:54Z")

</div>

You will have issues trying to use ‘|from\_json’ in a set\_fact as it is likely to cast the value back to a string before Ansible 2.0.

You should typically always use filters that change the data type in the “last mile”.

So instead of using set\_fact, just use the registered var where you need it. If you want, you could always use set\_fact to give you easier direct access to stdout, but you will still need to use ‘|from\_json’ in the last mile.

Such as:

(hosted\_zone\_list\_res.stdout | from\_json)[0].Id
