Unable to connect to the AWS EC2 instance using any method

0

I am running the free t2.micro instance. Since last night I have been unable to connect to the instance using any method. I've tried using Termius, Terminal, and the built-in console, but none work. My dashboard says the server is online and connectable though. I can't ask for support directly because of the aforementioned free tier. What should I do? I did reboot and stop & restart my instance but nothing works.

Abhinay
asked 10 months ago852 views
4 Answers
0
Accepted Answer

Based on this msg "EC2 Instance Connect is unable to connect to your instance" it look like there is a network misconfiguration of hardware failure. Can you confirm following:

  1. Check is system Status check is "2/2 checks passed"
  2. Check if you can telnet 22 port of server. If telnet works share the output of "ssh -v -i key.pem ubuntu@SERVER.IP"
  3. Check if 22 port is not blocked. use nmap like this "nmap SERVER.IP -Pn -p 22"
answered 10 months ago
    • system Status check is 2/2 checks
    • telnet 22 port of server : telnet: Unable to connect to remote host: Connection timed out
    • nmap 22/tcp status filtered ssh

    i did install ufw and entered following command

    sudo apt-get install ufw -y sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw allow 'Nginx HTTPS' sudo ufw allow 'Nginx Full' sudo ufw enable -y

0

Hi,

There could be many reasons why you can't access your EC2 instance, could you attach the error message so we can help you more precisely?

On the other hand, I recommend you take a look at the following Knowdlege Center article, specially to the Troubleshoot common errors sections, which explains how to troubleshoot issues to connect to an Amazon EC2 Linux instance using SSH, based on your error message.

profile picture
EXPERT
answered 10 months ago
0

Check if you have internet gateway attached to a VPC, without it you will not be able to connect to EC2 instance.

profile picture
answered 10 months ago
  • I have an internet gateway attached to my VPC and its state is "attached", it was working fine few days back

0

As per your comments, you installed UFW and only allow HTTP/HTTPS (Nginx) incoming. You did not allow incoming SSH at port 22.

i did install ufw and entered following command

sudo apt-get install ufw -y
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 'Nginx HTTPS'
sudo ufw allow 'Nginx Full'
sudo ufw enable -y

If you are running a OS (operating system) with SSM agent installed, you may be able to connect via SSM Session Manager. Try the steps at Connect to your Linux instance using Session Manager. You may need to reboot your EC2 instance for session manager to work.

AWS
EXPERT
Mike_L
answered 10 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