title: AWS ECS Container cannot connect to Elasticache cluster
body: <p>Quick and to the point.</p>
  <p>The ECS containers are running on EC2. I can connect to Elasticache Redis cluster from the EC2 instance but when inside the docker container I am getting</p>
  <pre><code>Warning: inverse host lookup failed for &lt;ip&gt;
  </code></pre>
  <p>I don't think that is necessarily the issue because that's just an error about reverse DNS lookup as far as I'm aware and the container is still getting the correct IP response for the lookup but I figure it's worth mentioning.</p>
  <p>The ECS containers are configured in <code>awsvpc</code> networking mode so the container gets its own ENI on the instance and inherits the instances, security group.</p>
  <p>The elastic cache cluster is accepting all traffic from the security group on the ec2 instance and like mentioned above the ec2 instance can connect to the Redis cluster but when in the docker container I cannot.</p>
  <p>To test this I have run a netcat <code>nc -v &lt;redis cluster endpoint&gt; 6379</code> from the ec2 and it connects correctly, but when in the docker/ecs container it timeout. The result from nc is as follows</p>
  <pre><code>user@hostname $ nc -v &lt;redis-endpoint&gt; 6379 
  Warning: inverse host lookup failed for &lt;returned-ip&gt;: Unknown host
  &lt;redis-endpoint&gt; [&lt;returned-ip&gt;] 6379 (?) open
  </code></pre>
  <p>Any ideas on what could be causing this issue?</p>
  <p>I don't think it's related to the SG because the ec2 instance can connect fine and to the best of my knowledge the ECS container (because it uses an eni on the same host) is using the same security group as the ec2 container but I am running out of ideas so any input is helpful.</p>
  <p>I also found this <a href="https://stackoverflow.com/questions/55090822/connection-to-redis-elasticache-from-elasticbeanstalk-ec2-fails">existing post</a> which may be something I need to consider, but at this time I can't even open a tcp connection to the Redis port so I haven't even made it to troubleshooting application issues yet.</p>