SSH connection timeout

0

Hi.. I am unable to ssh into my instance to make some php.ini setting changes. I get connection timeout. Here is what I have done:

  • I am on a Macbook running BigSur 11.6
  • I fully opened up SSH port 22 in Security Groups
  • Instance type is t2.micro
  • I have a public IP
  • I checked that no firewall is blocking.
  • I tried all the different usernames ubuntu, ec2-user, root.
  • Keyfile has been chmod 400'd.
  • My latest instance ID is i-0abb14d7fc4673fb1
  • ssh command with ip zero'd out below: ssh -i "mypem.pem" root@ec2-0-0-0-0.us-east-2.compute.amazonaws.com

I have been chasing google fixes for two days now with no avail. Thanks

  • Can you run the ssh command with the '-v' to see if the debugging information would give a clue?

2개 답변
1
수락된 답변

Connection timeout is typically related to end to end network connectivity issue and not to username or file permission. Have you followed the Knowledge Article guideline at: https://aws.amazon.com/premiumsupport/knowledge-center/ec2-linux-resolve-ssh-connection-errors/

Also do check that the subnet you deployed this EC2 instance into has route to Internet.

You can also try out the Session Manager instead of SSH connection as way to launch a secure connection into your Instance. Check out more here: https://aws.amazon.com/blogs/aws/new-session-manager/

profile pictureAWS
전문가
Toni_S
답변함 2년 전
  • Your second paragraph provided the answer. The subnet deployed to the EC2 instance did not have a route to the internet... I have been poking this so long now that I was surprised to see it finally connect.

0

Hi ! Thanks for using AWS re:Post and providing a brief description of the issue.

It seems that you have tried all the necessary steps for diagnosing the issue . I would suggest having a look at the Route table for the instance and making sure it has an internet gateway attached to it as you are trying to SSH to an instance using its public IP over the internet. Hence, the instance needs to be launched in a public subnet with an internet gateway in its route table (and not NAT gw) . If you need further help, Try opening a ticket with AWS support for their insights as well .

Reference :

[] Troubleshoot connecting to your instance - Error connecting to your instance: Connection timed out - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.html#TroubleshootingInstancesConnectionTimeout

AWS
지원 엔지니어
Ansh_C
답변함 2년 전
  • I checked the internet gateway.. but missed the "subnet with internet gateway" part... After rereading this, I see that your answer is also correct.. Thank you.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠