title: AWS ECS - Can't connect to RabbitMQ EC2 instance from ECS container instance on the same subnet
body: <p>I am building an application where I will have multiple <code>Docker services</code> running on <code>ECS container instance</code> communicating with each other via <code>RabbitMQ</code> which runs on a separate <code>EC2 instance</code> in the same <code>VPC</code>and in the same subnet. The <code>RabbitMQ</code> security group is configured to allow all the traffic from that subnet. </p>
  
  <p>However, when I start the <code>service</code> and it tries to connect to <code>RabbitMQ</code> I get an error saying <code>ECONNREFUSED 127.0.0.1:5672</code>. This is the url that I am using t connect <code>amqp://username:password@ipaddr:5672/?heartbeat=60</code>. The network mode for <code>Docker</code> is <code>default/Bridge</code>.</p>
  
  <p>I am setting the connection url via an environment variable and I did <code>ssh</code> into the <code>ECS</code> container instance and then <code>docker exec -it cntainerID /bin/bash</code> and was able to verify that the environment variable is set.</p>