AWS Ec2 "Connection refused" - amazon-web-services

I used to be able to connect to my ec2 instance but suddenly I am no longer able to and I do not know why. My security group is the same, allowing ssh from anywhere. I have some information below regarding the errors that I am getting. Please can someone advise?
From FileZilla I am getting:
Error: ssh_init: nodename nor servname provided, or not known
Error: Could not connect to server
From the terminal I am just getting:
ssh: connect to host ec2-xx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com port 22: Connection refused

i have the same issue i did the following troubleshooting steps and it still gives the same
ssh: connect to host [my public DNS] port 22: Connection refused
i checked the key ".pem" file and its correct on the right directory
no code edits as it used to work fine last night and suddenly this error appeared
i went to the AWS console, selected the instance , and clicked on connect and copied the SSH command to make sure that no typos , and the command is correct
i tried with -v , still same issue.
tried to reboot the instance , no progress
stop then start the instance , no progress
tried to detach the volum and re attach the volum back , no progress
i changed the instance type from t2.micro to t2.small , no progress
checked the security group , port 22 is assigned to all IPs and no problem with the security group at all as it used to work fine
tried from different computers from different networks, same issue
created new instance , i can access the new one but cant ssh to the old one still
my best guess is that the ssh daemon is not enabled but how to access it if i cant ssh to the instance

Related

unable to connect to the aws ec2 ubuntu instance

Getting error
failed to connect to your instance,
Previously it was running perfectly,
Could you please tell me, why is it not connecting?
my instance is running, occurring this error
failed to connect to your instance, error establishing ssh connection to your instance ec2
Thanks.
Use public and private i-e ppk,pem keys to connect the instance.
Is it possible to post screenshots of error that you are facing? It will give more clear idea. Few suggestions -
If in Security group, for port 22 you have used My ip, try removing it & again give my ip. As home router restarts, new ip is assigned to it.
Check if correct key is used ie pem or ppk

How to troubleshoot google cloud instance issue

I have a google VM instance that stopped working sometime in the last 4 days. The last time I tried to access it, everything was fine. By 'stopped working' I mean:
Unable to connect to websites hosted at that instance
Unable to connect to the instance using gcloud compute ssh
I can connect to the instance by opening an ssh terminal in a browser window from within console.gcloud.google.com.
Running gcloud compute ssh from my local terminal results in:
ssh: connect to host 34.69.41.204 port 22: Operation timed out
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
Connecting over http results in:
wget http://panam.whensparksfly.org
--2021-10-11 11:18:00-- http://panam.whensparksfly.org/
Resolving panam.whensparksfly.org (panam.whensparksfly.org)... 34.69.41.204
Connecting to panam.whensparksfly.org (panam.whensparksfly.org)|34.69.41.204|:80... failed: Operation timed out.
If I run that same wget command from the browser-based terminal I started from https://console.gcloud.google.com, it works.
I've tried stopping and restarting the instance. I also have another instance that I usually leave off. I started that instance and had the same problem.
Here are the firewall rules for that instance:
How should I go about troubleshooting this?
This is not an answer to my specific question about how to troubleshoot the problem, but here's how I resolved the issue:
Create a new machine image from the original instance
Create a new instance from the machine image. Go to the Machine Images page in the Google Cloud Console, click the Actions button for the desired image, then click create instance.
I was able to transfer my static external IP address to the new instance by following the instructions here.
Everything is now working as before.

AWS Connection timeout + EC2 Instance Connect not working

I tried to connect to a running ec2 instance with my usual settings, it returns
ssh: connect to host ec2 port 22: Connection timed out
I tried to connect with the built-in "EC2 Instance Connect", to connect directly from the browser with the AWS account, it returns
There was a problem setting up the instance connection An error
occurred and we were unable to connect or stay connected to your
instance. If this instance has just started up, try again in a minute
or two.
The instance was running for weeks, I am the only user with access to the AWS account and the SSH Keys and I didn t change any setting in the last ~3 weeks or restarted it
1st the timeout started ~1 week ago, nand then without any other change, my website (wordpress) suddenly started to show a database connection error (the database in inside the EC2 instance as well)
What I used to connect :
Either
ssh -i "Keys.pem" ec2-user#ec2-[public ip].eu-west-3.compute.amazonaws.com
Or
ssh ec2-user#[public ip] -i "Keys.pem"
Both show the same error. I used the first one several weeks ago and it used to work well
This timeout will be caused by invalid security group rules.
Ensure that the security group rules attached to your instance allow inbound access from the source IP address you're trying to SSH from, the database connection may also be related to this.
If you're connecting using a dynamic public IP address to SSH to your host, you will need to adjust this every time your IP address changes. It might be more appropriate to setup a VPN so that you can connect privately to your host.

Can not connect with AWS : Connection time out error

I am using ssh command to connect with AWS instance :
ssh -i ./abcd.pem ubuntu#ec2-**-***-**-**.us-east-2.compute.amazonaws.com
These are my inbound rules :
Earlier It was working well suddenly it started giving this error I have also tried with different networks still the same problem.
Assuming that AWS hasn't stopped you from connecting because you're out of money, the simplest explanation is that your host is simply unstable and needs to be rebooted.
Stop your instance and start again, try to connect by new IP address, if still not works, you have the Internet connection problem.

Cannot ssh to newly-launched instance in AWS

Several months ago, my friend decided to stop one of his instances. Before stopping it, he created an image of its used to launch it again in the future.
Today, I launch the new instance again from that image, but I cannot ssh into that new instance while I can still ssh into the his old instance. I use the same key pair and security group as the old instance.
The error is: ssh: connect to host xxx.xxx.xxx.xxx port 22: Connection refused
What are the possible causes and how can I fix them?
Connection refused indicates a network failure when trying to ssh. You shuold make sure your server contains a security group allowing your IP to connect to the server via port 22.
You can resolve the issue by adjusting the permissions of "/var/empty/sshd":
chown root:root /var/empty/sshd
chmod 711 /var/empty/sshd
If it does not solve your issue please share the output of telnet.