# How to trace/debug Ansible EC2 ?

**URL:** <https://forum.ansible.com/t/how-to-trace-debug-ansible-ec2/20881>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [March 16, 2016, 7:13am UTC](https://forum.ansible.com/t/how-to-trace-debug-ansible-ec2/20881 "2016-03-16T07:13:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tzach\_Livyatan1](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@Tzach\_Livyatan1](https://forum.ansible.com/u/Tzach_Livyatan1)\
**Post date:** [March 16, 2016, 7:13am UTC](https://forum.ansible.com/t/how-to-trace-debug-ansible-ec2/20881/1 "2016-03-16T07:13:17Z")

</div>

Hello  
I have a problem with a simple Ansible playbook which launch an EC2 instance.  
The instance configuration is slightly different (different block-device-mapping) when I launch the same AMI from EC2 dashboard.  
To debug, I would like to see the exact AWS command Ansible/Boto runs.  
ansible-playbook -vvv option does not provide it, how can I go deeper into the code and traces?

Thanks  
Tzach

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [March 16, 2016, 1:57pm UTC](https://forum.ansible.com/t/how-to-trace-debug-ansible-ec2/20881/2 "2016-03-16T13:57:30Z")

</div>

Since the ec2 modules use boto, which doesn’t really execute commands, your best bet is to run your playbook with the environment variable ANSIBLE\_KEEP\_REMOTE\_FILES=1 set, and with -vvv. This will allow you to examine the modules left on the target system (most likely localhost) and run them directly with your Python debugging method of choice (epdb, etc.).

---

<div class="post-metadata">

**Author:** ![Tzach\_Livyatan2](https://avatars.discourse-cdn.com/v4/letter/t/58956e/32.png) [@Tzach\_Livyatan2](https://forum.ansible.com/u/Tzach_Livyatan2)\
**Post date:** [March 16, 2016, 3:09pm UTC](https://forum.ansible.com/t/how-to-trace-debug-ansible-ec2/20881/3 "2016-03-16T15:09:10Z")

</div>

> Since the ec2 modules use boto, which doesn't really execute commands,  
> your best bet is to run your playbook with the environment variable  
> ANSIBLE\_KEEP\_REMOTE\_FILES=1 set, and with -vvv. This will allow you to  
> examine the modules left on the target system (most likely localhost) and  
> run them directly with your Python debugging method of choice (epdb, etc.).

Thanks I will try  
Was not aware of ANSIBLE\_KEEP\_REMOTE\_FILES=1
