# Connection timed out while connecting to upstream on AWS

**URL:** <https://meta.discourse.org/t/connection-timed-out-while-connecting-to-upstream-on-aws/46517>\
**Category:** Self-hosting\
**Tags:** hosting\
**Created:** [Juin 27, 2016, 4:15 UTC](https://meta.discourse.org/t/connection-timed-out-while-connecting-to-upstream-on-aws/46517 "2016-06-27T16:15:40Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![stefanini.mf](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stefanini.mf/32/121693_2.png) [@stefanini.mf](https://meta.discourse.org/u/stefanini.mf)\
**Post date:** [Juin 27, 2016, 4:15 UTC](https://meta.discourse.org/t/connection-timed-out-while-connecting-to-upstream-on-aws/46517/1 "2016-06-27T16:15:40Z")

</div>

I’m hosting a discourse instance (running latest), on aws with 7.5gb ram and 2 CPU’s (it’s a m3.large).

While sometimes discourse works okay, some other times requests seem to get stuck and people either see a infinite loading or get 502 from ngnix.

taking a look at our `error.log` from ngnix the following message pops up at these times:

```plaintext
upstream timed out (110: Connection timed out) while connecting to upstream, client: 187.62.216.182, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "www.guj.com.br"

```

Which seems strange as most of times the machine still has 2-3 GB of free memory, and CPU and RDS don’t show any excessive usage.

Any ideas on tunings we could try, or what could we be doing wrong?

---

_[View the full topic](https://meta.discourse.org/t/connection-timed-out-while-connecting-to-upstream-on-aws/46517)._
