unable to connect to the aws ec2 ubuntu instance - amazon-web-services

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

Related

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.

GCP VM instance hosted Website showing connectino refused error message

I am trying to fix a website that is hosted on Google Cloud Platform using VM instance. The website is giving me a connection refused error message. I have checked that the firewall rules are set up and are provided to the VM instance.
The VM external IP is static and the same IP is present on both cloud DNS and GoDaddy.
I'm also unable to SSH into the instance.
The SSH screen is stuck here and is not loading any further
I have given the necessary permissions to the instance and the user (Compute Admin, Compute Instance Admin (v1)), but still no luck.
As the instance is created from a custom image, so later, I tried creating another instance with the same config and I was able to SSH from it. So, please find some screenshots attached below if those could be of any help
netstat -a
route -n
df -h
I am new to this so any help to fix the issue and get the website up and running would be highly appreciated.
If it worked at the second attempt (2nd Instance I mean), I suspect that the SSH service hasn't started properly. I would recommend you to check the Serial Port Output, and Accessing into the Instance through the serial port in order to be able to troubleshoot it.
Note that you'll need a user to access through the serial port. If you don't have any user created, you will be able to do so using an startup-script.
Hope this helps!

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.

AWS Ec2 "Connection refused"

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

Transferring files to AWS instance using FileZilla

FileZilla throws errors when trying to connect to AWS instance via SFTP mode. Instance is running on Ubuntu 13.10.
Error: Connection refused
Error: Could not connect to server
Connection params:
Host: XX.XX.X.XXX
Username: ubuntu
Port: 22
Problem solved: seems that my instance was glitchy. Terminated the old one and create new. Working now.
By default the Security groups keeps all the ports closed. You need to enable the SFTP port in the security group: Amazon EC2 Security Groups
Another, thing is to ensure an SFTP server is running on the instance (you can login/SSH to the instance and try connecting SFTP locally and check this).
Open the appropriate inbound port in your Security Group as described here.
Import the .pem key pair associated to your EC2 instance into FileZilla.
The way to access your instance is described here.