AmritpalNagraMe AmritpalNagraMe - 2 months ago 16
Linux Question

Unable to ssh to EC2 from Ubutnu(connection times out)

May be i have forgot something because I am using AWS after a long time, i am sorry if i am making some stupid mistake.Here is what i am doind:


  1. I launched Amazon Linux AMI(ami-fdb8229e).

  2. Added ssh port (22) for my ip address to the inbound rules in the associated security group.

  3. Changed the permissions of identification file to 400.

  4. When i try to connect to instance using "ssh -vvv -i "Firstsetup.pem" ec2-user@ec2-52-221-218-255.ap-southeast-1.compute.amazonaws.com" i am getting output



OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: /etc/ssh/ssh_config line 19: Applying options for *

debug2: resolving "ec2-52-221-218-255.ap-southeast-1.compute.amazonaws.com" port 22

debug2: ssh_connect_direct: needpriv 0

debug1: Connecting to ec2-52-221-218-255.ap-southeast-1.compute.amazonaws.com [52.221.218.255] port 22.

debug1: connect to address 52.221.218.255 port 22: Connection timed out

ssh: connect to host ec2-52-221-218-255.ap-southeast-1.compute.amazonaws.com port 22: Connection timed out

Answer Source

Check if your ISP allows you to do ssh on AWS. I too had this problem, from my office I couldn't ssh to the instance but from my home I was able to do. Later came to know that port 22 was blocked in our office.