Score:0

AWS EC2 ssh: connect to host, port 22: Operation timed out, nothing has changed?

lc flag

I'm sure a number of you were seeing red and ready to hit that downvote button as soon as you saw this question popping up again. It really does pain me to be asking a question that was seemingly answered elsewhere by simply adding a firewall exception. At this point, google search results are purple (visited) for me well down the page and I'm drawing a blank on how to continue.

I set up an EC2 instance and was able to connect fine over ssh with the key for about a day. I haven't actually done anything on it yet but when I went back to connect again it was timing out. I tried AWS Instance Connect as well but that failed with the "Failed to connect to your instance EC2 Instance Connect is unable to connect to your instance." message. Instance Connect previously worked yesterday.

The instance shows as running so I tried a reboot but that also didn't work. I also tried connecting from different networks to no avail.

At this point, I began checking all the usual suspects, port 22 is open for all IPs in the security group for inbound traffic, the Ubuntu user should be the default user still, I'm using the same connection info that previously worked (that being the public ip/compute-1.amazonaws.com domain).

My next step was to try stopping and starting the instance, which changed the IP but did not allow me to connect to it.

I then terminated the instance and rebuilt a second instance. That worked for a day, but here we are a day later with the same issue.

I often see checking the vpc/subnet as another possible source of the issue but that all checks out and the igw and everything else are still attached and with the proper routing rules (cross checked with a working instance to confirm).

I can only assume since this issue has followed me to a new instance that it's comething to do with my setup but I'm at a loss for how to continue as most of the troubleshooting steps involve connecting using instance connect or ssh, neither of which I can do. Has anyone else experienced this before?

sa flag
First silly check: can you ping the instance?
sa flag
Second: is this a non-unlimited t instance? if it's a non-unlimited t instance, is it out of CPU credits? as this will cause it to run at 1/20 of normal speed.
Tim avatar
gp flag
Tim
I've been using AWS for quite a few years professionally, I don't recall this happening to me or hearing of it happening to anyone I know. It's a bit of a puzzle, sounds interesting. Try connecting with Session Manager from the EC2 console - that relies on an _outgoing_ https connection from the internet - try it a few times as that sometimes helps. Next use the EC2 console to get an instance screenshot and instance logs. Next create a fresh instance in the same subnet and try connecting from there. Report back results.
joeybab3 avatar
lc flag
Sorry for the late replies, I didn't get notified there were comments for some reason... @user253751 No, no response from host doing that, there is no "cpu credit balance" like my other instance so I'm assuming this is unlimited?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.