title: SSH to docker container in ECS Fargate task
body: <p>We're implementing our Applications and databases on AWS ECS-Fargate. And I'm just wondering how can I SSH into the containers reside in the Fargate task.</p>
  
  <p>The docker image is configured to accept ssh connections based on this post:</p>
  
  <p><a href="https://docs.docker.com/engine/examples/running_ssh_service/" rel="nofollow noreferrer">https://docs.docker.com/engine/examples/running_ssh_service/</a></p>
  
  <p>We have 2 containers in the ECS fargate task (PHP and MySQL), and has this IP address: 100.10.35.120</p>
  
  <p><a href="https://i.stack.imgur.com/92Ry2.png" rel="nofollow noreferrer">docker containers</a></p>
  
  <p>Port 22 is opened in the "task definition", and exposed inside the dockerfile:</p>
  
  <p><a href="https://i.stack.imgur.com/JpUSQ.png" rel="nofollow noreferrer">task definition port 22</a></p>
  
  <p>Security group has port 22 opened to all:</p>
  
  <p><a href="https://i.stack.imgur.com/CEea3.png" rel="nofollow noreferrer">security group port 22</a></p>
  
  <p>I can ping on the IP address from my VPN network, but cannot telnet on port 22 or use ssh:</p>
  
  <p><a href="https://i.stack.imgur.com/PJKLr.png" rel="nofollow noreferrer">ping is working, while telnet and ssh are not</a></p>
  
  <p>Can anyone help me fix this issue please, we just want to have ssh access to the docker containers in the fargate task.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Regards,
  Ali</p>