# Random SSH connection reset during EC2 provisionning

**URL:** <https://forum.ansible.com/t/random-ssh-connection-reset-during-ec2-provisionning/17929>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [April 8, 2015, 2:34pm UTC](https://forum.ansible.com/t/random-ssh-connection-reset-during-ec2-provisionning/17929 "2015-04-08T14:34:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Warren\_Seine](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@Warren\_Seine](https://forum.ansible.com/u/Warren_Seine)\
**Post date:** [April 8, 2015, 2:34pm UTC](https://forum.ansible.com/t/random-ssh-connection-reset-during-ec2-provisionning/17929/1 "2015-04-08T14:34:22Z")

</div>

Hi,

I use Ansible to provision Ubuntu 14.04 machines. Some machines are at a dedicated provider’s, some are EC2 instances. Provisionning works great for the first ones, but sometimes fails with EC2 VMs. The failure is typically an SSH disconnection. Error messages usually indicate “Connection closed by peer” or similar depending on the log level and the step where it fails. They happen randomly during the provisioning which takes about 15 minutes. If I re-provision, it may succeed.

I guess this is not Ansible’s fault, but I was wondering if someone had the same experience. I’m using a vanilla Ubuntu AMI and haven’t tweaked the SSH settings at all.

Thanks,  
Warren.

---

<div class="post-metadata">

**Author:** ![Mark5](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@Mark5](https://forum.ansible.com/u/Mark5)\
**Post date:** [April 13, 2015, 7:11pm UTC](https://forum.ansible.com/t/random-ssh-connection-reset-during-ec2-provisionning/17929/2 "2015-04-13T19:11:21Z")

</div>

I’ve run into similar issues, provisioning to RHEL servers from Ubuntu. Either SSH connection refused, terminated, reset, etc. I’ve even tried uploading my ubuntu VM to ESXi, and get the same thing there. I’m backing down to 1.8.4 of Ansible to see if it still occurs, I don’t think I ran into these issues until the package was upgraded.

---

<div class="post-metadata">

**Author:** ![Warren\_Seine](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@Warren\_Seine](https://forum.ansible.com/u/Warren_Seine)\
**Post date:** [April 14, 2015, 12:14pm UTC](https://forum.ansible.com/t/random-ssh-connection-reset-during-ec2-provisionning/17929/3 "2015-04-14T12:14:25Z")

</div>

I’m using Ansible 1.8.3, from OS X to Ubuntu 14.04.

I ended up using Ansible locally on the EC2 machine. Not only it works all the time, but it’s also about 10x faster.
