# What does Ansible module do when communicating with AWS?

**URL:** <https://forum.ansible.com/t/what-does-ansible-module-do-when-communicating-with-aws/26421>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [January 5, 2018, 7:44am UTC](https://forum.ansible.com/t/what-does-ansible-module-do-when-communicating-with-aws/26421 "2018-01-05T07:44:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cherry](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@Cherry](https://forum.ansible.com/u/Cherry)\
**Post date:** [January 5, 2018, 7:44am UTC](https://forum.ansible.com/t/what-does-ansible-module-do-when-communicating-with-aws/26421/1 "2018-01-05T07:44:08Z")

</div>

I’m meeting a problem that:

When using Ansible ec2\_elb\_facts module to gather ALL elb info in an aws account, it kept failed even if retry\_times=100+

However, when using Shell to call aws cli directly, it is fast.

So, Im wondering **what does ansible module do when communicating with AWS** especially for ec2\_elb\_facts module.

I got following logs when executing ansible playbook to gather elb information:

**2018-01-05 14:37:23,083 p=6721 u=xx | 6800 1515134243.08363: getting output with communicate()**  
**2018-01-05 14:38:49,437 p=6721 u=xx | 6800 1515134329.43786: done communicating**  
2018-01-05 14:38:49,438 p=6721 u=xx | 6800 1515134329.43809: done with local.exec\_command()  
2018-01-05 14:38:49,440 p=6721 u=xx | 6800 1515134329.43893: \_low\_level\_execute\_command() done: rc=0, stdout=

All fast except the there is a great time gap between the first two line. This log is only for test, when running in our actual environment, it keeps more than **half an hour** and then failed.

This is ansible code:

- name: Gathering ELB information - all in the account  
ec2\_elb\_facts:  
aws\_access\_key: “{{ AWS\_ACCESS\_KEY }}”  
aws\_secret\_key: “{{ AWS\_SECRET\_KEY }}”  
region: “{{ AWS\_REGION }}”  
register: ELB\_INFO  
until: ELB\_INFO.failed is not defined or ELB\_INFO.failed == false  
retries: 100  
delay: 5

Can anyone help me to figure out what happened between “getting output with communicate()” and “done communicating”?

Why it is so slow and leads to fail when running in my real aws envrionment?

Thanks in advance!
