# AWS Dynamic Inventory ec2.py cache doesn't work?

**URL:** <https://forum.ansible.com/t/aws-dynamic-inventory-ec2-py-cache-doesnt-work/29258>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [December 13, 2018, 6:21pm UTC](https://forum.ansible.com/t/aws-dynamic-inventory-ec2-py-cache-doesnt-work/29258 "2018-12-13T18:21:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alb0t](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@Alb0t](https://forum.ansible.com/u/Alb0t)\
**Post date:** [December 13, 2018, 6:21pm UTC](https://forum.ansible.com/t/aws-dynamic-inventory-ec2-py-cache-doesnt-work/29258/1 "2018-12-13T18:21:24Z")

</div>

Every time I run this plugin, it takes at least a minute to get anything back. Each time it is execute I can see a new cache being built inside ~/.ansible/tmp. Has anyone else had this problem?

$ time ./ec2.py --refresh-cache \> /dev/null

real 1m30.124s

user 0m3.784s

sys 0m0.357s

$ time ./ec2.py --list \> /dev/null

real 1m17.029s

user 0m3.692s

sys 0m0.334s

$ time ./ec2.py --list \> /dev/null

real 1m36.347s

user 0m3.783s

sys 0m0.381s

$ env|grep INI

EC2\_INI\_PATH=/etc/ansible/ec2.ini

$ egrep ‘cache\_path|cache\_max\_age’ $EC2\_INI\_PATH

cache\_path = ~/.ansible/tmp

cache\_max\_age = 3000

---

<div class="post-metadata">

**Author:** ![Tchia04](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@Tchia04](https://forum.ansible.com/u/Tchia04)\
**Post date:** [December 14, 2018, 4:12am UTC](https://forum.ansible.com/t/aws-dynamic-inventory-ec2-py-cache-doesnt-work/29258/2 "2018-12-14T04:12:04Z")

</div>

You can probably reduce some time by setting the region that expect your resource to be in and one or note tags in the ex2.ini file

---

<div class="post-metadata">

**Author:** ![Alb0t](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@Alb0t](https://forum.ansible.com/u/Alb0t)\
**Post date:** [December 14, 2018, 5:46pm UTC](https://forum.ansible.com/t/aws-dynamic-inventory-ec2-py-cache-doesnt-work/29258/3 "2018-12-14T17:46:43Z")

</div>

What’s the point of the cache then if it doesn’t re-read the cache?
