3

I am new to AWS. Luanched an EC2 instance and set it up to server a Laravel application. Out of nowhere I am not able to SSH into the instance (which was working fine)

Network error: Connection timed out

The application is accessible through browser. But not able to SSH into the instance.

Nauman Zafar
  • 1,083
  • 15
  • 40

3 Answers3

3

Since your application is accessible for browser, I hope you know how to configure the inbound connections. I believe your machines IP address has changed due to which you are not able to access. Your IP can change if you have reset/switch on/off the Internet or if you are connecting from a different Internet connection after the initial server configuration.

You need to follow these steps

Open the inbond connection for SSH
1. EC2 bashboard - > click the respective Security Group
2. Select the Public SG - > click inbond tab
3. Add an entry SSH | TCP | 22 | Select MyIP

Kind Regards
Robin

Emre Sevinç
  • 8,211
  • 14
  • 64
  • 105
Robin Varghese
  • 1,158
  • 10
  • 22
  • 1
    There is an entry for SSH with the configuration you recommended. As I said it was previously working. I was able to SSH into the instance. But now it doesn't. And this is the second instance with the same problem. – Nauman Zafar Oct 10 '17 at 12:05
  • Please try updating the SSH entry by selecting the My IP part alone. – Robin Varghese Oct 10 '17 at 12:17
  • 1
    Also, please check the CPU utilization. AWS automatically provides data such as Amazon CloudWatch metrics and instance status, which you can use to see how much CPU load is on your instance and, if necessary, adjust how your loads are handled. Recently I moved my micro instance to small due to performance issue. My server was going into hung state after 10-15 concurrent users online. Memory was getting exhausted and CPU was running full. In this state SSH doesn't works and I had to wait for few hours to access the Linux box using SSH. – Robin Varghese Oct 10 '17 at 12:19
  • Actually I was just trying out AWS on Free Tier. It is just a basic laravel install for testing purpose.Nothing extensive – Nauman Zafar Oct 10 '17 at 12:22
  • Please select the EC2 instance from dashboard and select monitor – Robin Varghese Oct 10 '17 at 12:24
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/156357/discussion-between-robin-varghese-and-nauman-zafar). – Robin Varghese Oct 10 '17 at 12:28
  • Hi @RobinVarghese - this worked for me after adding myIP, but at the same time range of 0.0.0.0/0 is also added. Why that did not worked? Any idea? How can I correct it by putting some generic rule. +1 as it worked for me and this post is old as well, so might be I have missed something. – shaILU Dec 27 '19 at 01:02
  • Please don't use 0.0.0.0/0, because it is saying SSH can be done from anywhere. Instead, specific IP should be used. – Robin Varghese Dec 30 '19 at 02:02
0

Please use the user ec2-user@52.14.24.61

Robin Varghese
  • 1,158
  • 10
  • 22
0

Could it be that you are trying to SSH into the instance from a corporate network, or one that does not allow outbound connections on port 22 (ssh) ? See my answer here: https://stackoverflow.com/a/45634848/981913

Andrei Socaciu
  • 1,198
  • 9
  • 20
  • Not such a scenario. It was working fine with the same network I am currently using. I tried creating & configuring a new instance. The same issue. One time ssh access is good. but after some time. It gives timeout issue. – Nauman Zafar Oct 11 '17 at 13:54