I can ping my EC2 instance, but I cannot connect through ssh - amazon-web-services

A while back I had created an RHEL EC2 instance. Set it up correctly and was able to connect to it through putty and WINSCP. Over time it hasn't been used but until recently it needed to be accessed again. I went to check to login but wasn't able to. So i reboot the instance and try to reconnect but I cannot anymore. I get the error "Network error: Connection refused."
I tried recreating the ppk from pem, and also enable all ports to all IP's. What could have caused this un-reachability and are there any troubleshooting tips for me to connect to it again?

There are a few things to check here:
Did you have anything running on the box that might have caused it to become unresponsive over time? This is somewhat unlikely since you said you rebooted the machine.
Check your security group settings to ensure that the firewall is not blocking your SSH port. The instance has no way of knowing whether connections will actually be accepted by the Amazon network on the SSH listening port.
Amazon hardware can fail and cause your instance to become unresponsive. Go to the Instances page on your EC2 console and see if 2/2 of the status checks are passing. If less than 2 are passing, this is probably a failed instance situation.
As a last resort, try right-clicking the instance and checking the system log for anything that might have caused the instance to not listen for SSH connections.
Hopefully you have your data on an EBS volume such that you can simply stop and start the instance and have it come up on different hardware. While it would be nice if Amazon provided console level access to the box, unfortunately they do not presently (as far as I know).

Related

EC2 server losses internet connection and application fails to send email, sms and even yum updates

I have 5 EC2 servers in the same VPC and all of a sudden yesterday, all of my applications started failing to send email and sms. So I tried doing git pull of my project it also timed out. Then tried to install telnet using yum that to failed with Time out. I have checked almost everything including Network ACLs, Security Groups, Subnets, Iptables, etc and everything is correct. I am not sure why is this happening.
The weird thing is if I reboot the server once the internet comes for a brief amount of time and again it disconnects.
Attaching below are the errors I am facing:
Error while Generating the Tiny URL. Error: {"errno":-110,"code":"ETIMEDOUT","syscall":"connect","address":"XXX.XX.XXX.XX","port":443}
Error SendEmail UnknownEndpoint: Inaccessible host: `email.ap-south-1.amazonaws.com'. This service may not be available in the `ap-south-1' region.
Attaching screenshots of my Network ACLs, Security Groups, Subnets, and iptables:
Please help with what am I doing wrong or if is this an issue with AWS EC2? My goal is to make sure my application works without timeout and git and yum starts working.
Did you try terminating and reprovisioning the instances, rather than rebooting them? There may be some problem with the underlying hardware. When you terminate and recreate an instance, it will likely end up in a different rack in the datacenter, which may solve the problem.
If the above helps, you should consider setting up an application load balancer with an auto scaling group, with health checks enabled for both, so that the auto scaling group terminates unhealthy instances and replaces then with the new ones automatically.
You may also consider using Simple Notification Service and stop worrying about underlying compute for e-mail and sms distribution altogether!

What can I do to solve Google Cloud vm instance network problem

The network is working before and I have not change anything on vm. After few months, I can not access the vm instance.
The vm instance is running
I will get "Request timed out" when ping to external network ip address.
I can not access SSH. The SSH port was open properly.
When troubleshooting my connection status of SSH in browser, it is stuck on Network status.
What should I do to know the reason of problem? After I restart the vm instance few times, it will running normally for a period, but the problem will appear again.
Any idea to make sure the vm instance will not disconnect from external network with this reason again?
Here are the resource consuming of my vm
In this case, VESTACP minimum system requirements for VM instances should be okay. But you can also consider the workload process for your VM instance.
I recommend switching to a higher N1 machine types to provide good performance for the workload and machine requirements.

Can't connect to one EC2 instance in the same security group of another accessible EC2 instance

I have two EC2 instances running Windows. They are both in the same security group which allows for all outgoing ports, but only RDP ports from my IP. What I can't figure out is that both, to my examination, have the same security and networking settings, but one connects through RDP but the other one doesn't.
Any suggestions for settings to look at?
After a few attempts of download the .rdp file, checking the inbound rules, running nslookup myip.opendns.com resolver1.opendns.com to see my IP just to make sure I wasn't going crazy.
Ultimately what solved the problem was restarting my own computer and running the .rdp file. Not sure why, but maybe my computer was sending stale configuration data.

EC2 Network Error -- Timeout

I am having trouble sshing into my EC2 instances since I restarted my account. I connect to a new tmicro instance for about 4 minutes, but I get a broken pipe error and am thereafter unable to connect despite restarting the instance and my computer (timeout err).
I've confirmed that I'm connecting on port 22. I've confirmed that port 22 is open and unblocked. Shut off the firewall and all that. Connected to other sites via ssh. I have read through the troubleshooting on security groups and what not. It all seems very simple and obvious stuff that I haven't done wrong. Everything appears to be in order, as I confirmed launching an instance with an identical configuration as a friends, and we walked through the steps together over a hangout...
Can anybody advise on follow up? Has anybody encountered something like this with SSH in general? Nothing pops out to me in my logs or the server logs I can see on AWS. And it seems I've isolated most of the variables that I can in the steps I tried.
Firewall - "Shut off the firewall and all that" - are you using something like iptables on the instance itself? To keep things simple, I just use the AWS security groups because otherwise you need to maintain two firewalls which is confusing. Maybe there's an issue here. What do you mean by shutting the firewall off?
Logs - tail the ssh logs while you're still connected (I think tail -f /var/log/audit.log). Is there anything in there?
SSH - when you fail connect, use the -vvv flag and let us know what you get.
To prevent the broken pipe, you probably need to modify config in /etc/ssh/ssh_config. Look at ServerAliveInterval.

Browser returns "No data received" for my Amazon EC2 instance over and over again

I've experienced two times now of the "No data received" issue ever since I've moved my WordPress site to use RDS.
Though I could still connect to my RDS via MySQLWorkbench, but not able to connect to my instance via SSH (It shows "Operation timed out") after this issue has happened each time.
Doing "ping" in Terminal would show that my instance is "100.0% packet loss", and rebooting the instance would not fix this issue neither. I've set the correct IP for the SSH in the security groups inbound rules, and also checked that my instance is appear to be running on the EC2 console. The browser would still returns "No data received.".
Interestingly, I've found that stopping the instance, and then restart the instance and the httpd service would fix the issue. However, this issue will always come back again after couple of hours.
Could anybody help me or guide me to troubleshoot it, please?