Unable to ssh into my ES2 Instance

0

Hi all. I have had a long day and Im getting really stressed because I am getting deeper into AWS and its been tough. I don't even know where to start with this problem but I created a ES2 instance so I can make a python package for my lambda function and I need to ssh into my instance but it's timing out. Im sure it has something to do with one of my settings in the images Im sharing. Thank you for the help I really appreciate it. Sorry if I seem stupid in all of this.

Enter image description here Enter image description here Enter image description here

ssh: connect to host ec2-34-226-204-146.compute-1.amazonaws.com port 22: Connection timed out is the error I get.

Kevin
asked 8 months ago1710 views
3 Answers
0

Hello.

It looks like the security group's inbound rules only allow connections from the security group.
Please allow SSH on the global IP you are using.
If you select "MyIP" when setting up an inbound rule, your global IP will be entered.
sg

profile picture
EXPERT
answered 8 months ago
profile picture
EXPERT
Steve_M
reviewed 8 months ago
  • I changed it to Type SSH and Source Info to My IP. It still does not let me connect.

  • thank you for your reply. Is the subnet in which EC2 is launched a public subnet and correct?

0

Hi!

My best recommendation is using the ** VPC Reachability Analyzer ** (https://docs.aws.amazon.com/vpc/latest/reachability/what-is-reachability-analyzer.html) where you can test a path from your Internet Gateway to your EC2 instance (and you can specify port 22, or even specific source IPs)

If you can use Session Manager to connect to the instance instead, since this sounds like you don't need an ongoing SSH connection with the instance, that might be able to bypass the issue.

If you still need to SSH into the instance, there have been some other posts made in the past with the same issues (https://repost.aws/knowledge-center/ec2-linux-resolve-ssh-connection-errors). The gist of the post is that -Security Group needs to be open to port 22 on your IP (you can manually put in the IP if the My IP isn't working, using the ipconfig command on your computer to find it, to ensure that it's the same. Sometimes a VPN can mess this up). -Verifying the route table/subnet/NACLs, which seem to be OK based on your screenshots.

AWS
answered 8 months ago
  • Thank you, yes I had tried Session manager as well but it was not easy to understand for a first time user. But you are right - the security group had come conflicting rules. I created a brand new instance finally, and managed to allow all HTTPS and SSH traffic on all ports and now this instance works fine.

0

Hi, I came across this while troubleshooting my issue which seems exactly the same as described above. I am unable to connect with SSH: ssh -i "<valid.pem>" ec2-user@ec2-3-137-173-192.us-east-2.compute.amazonaws.com results in:- debug1: Connecting to ec2-3-137-173-192.us-east-2.compute.amazonaws.com port 22. ssh: connect to host ec2-3-137-173-192.us-east-2.compute.amazonaws.com port 22: Operation timed out

Clicking on the "Public IPv4 address" openAddress also results in "This site can’t be reached". Tried ping on AWS CloudShell as well, but its the same result. I have played with security groups as suggested above and followed most of the troubleshooting guides online. Yes my EC2 is launched in a public subnet. Not sure what setting is incorrect. Is there any ongoing issue?

R
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions