- Newest
- Most votes
- Most comments
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:
- Check is system Status check is "2/2 checks passed"
- Check if you can telnet 22 port of server. If telnet works share the output of "ssh -v -i key.pem ubuntu@SERVER.IP"
- Check if 22 port is not blocked. use nmap like this "nmap SERVER.IP -Pn -p 22"
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.
I try to Connect using EC2 Instance Connect, and I get error : Failed to connect to your instance EC2 Instance Connect is unable to connect to your instance. Ensure your instance network settings are configured correctly for EC2 Instance Connect. For more information, see Set up EC2 Instance Connect at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-set-up.html.
Hi,
First of all, until yesterday were you able to connect from the web console or only from Termius or/and Terminal? I mention this because Amazon EC2 Instance Connect requires that your instance has the EC2 Instance Connect package installed, permission on your user to push the public key to the instance, and the security group must allow EC2 Instance Connect access to SSH on TCP port 22. Could you check that everything is configured correctly?
On the other hand, what error do you get when you try to connect from the terminal?
till now i mainly use Termius and web console to test if Termius & terminal didn't connect IAM has super admin level permission and security group inbound rules allow EC2 Instance Connect access to SSH on TCP port 22.
Check if you have internet gateway attached to a VPC, without it you will not be able to connect to EC2 instance.
I have an internet gateway attached to my VPC and its state is "attached", it was working fine few days back
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.
Relevant content
- asked 10 months ago
- asked 8 months ago
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
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