Public DNS (IPv4) gives ERR_CONNECTION_REFUSED after reboot - amazon-web-services

I have a t2.large EC2 instance running with an elastic IP. Whenever I choose to reboot the Instance, it gives a "This site can’t be reached, .... refused to connect." error.
I have tried rebooting it via SSH and also creating the a new instance from a snapshot. Creating a new instance does work but that's obviously not a solution. I have tested the url on different ISPs and all of them give the same error. What could be going wrong here?
I have also made sure that the Security group does allow Inbound traffic from my IP.

Turn out a simple sudo service httpd restart does the trick. You can try restarting it twice if you get a [FAILED] for Stopping httpd: and [OK] for only Starting httpd:
You have to make sure you allow Inbound Traffic from your IP in your Security Group before giving this a try.

Related

Can't reach to an AWS EC2 instance website

I just launched a instance on AWS and I'm trying to open the website. So I copy the Public IPv4 address and paste it on my page. But it always returns This site can’t be reached 35.78.183.239 took too long to respond.
I've changed my firewall setting to access google chrome and set security groups HTTP, HTTPS. I can't figure out where the problem is. Any suggestions?
You didn't specify what webserver or AMI is on your EC2 instance.
You need to setup an AMI or manually install and setup a webserver for anything to show, otherwise the EC2 instance, while reachable, will not respond.
Make sure that ssh access is enabled and try ssh into the machine. If you can successfully login, then you know the instance is reachable and the problem is with your webserver software. This will help you debug.
What port is your application running on? When you enable HTTP and HTTPS it only allows ports 80 and 443 on the security group. This won't help if your application runs on a different port, so you'll need to add that to your security group to allow inbound traffic.

AWS ec2 instance not accessible trhough browser and ssh due to timeout error

It's working fine. All of a sudden it started throwing 504 Timeout error. In SSH it was showing ubuntu upgrade warning, I've installed the necessary and upgraded correctly hoping that it would not throw errors anymore. But still the issue persist.
I've checked the inbound rules in AWS, all good for port 80,443 and 22. I dont have SSM agent installed in AWS and I dont find the right guide to install that.
Which could have possibly gone wrong?
Based on the comments.
The issue was that instance was restarted. Consequently, the public IP provided by AWS has changed:
We release your instance's public IP address when it is stopped, hibernated, or terminated. Your stopped or hibernated instance receives a new public IP address when it is started.
To overcome this issue in the future, you can attach an elastic IP (EIP) to your instance. EIP persists between restarts and is free as long as it is attached to a running instance.
First, attach one elastic IP with your existing instance which then you can one public IP and EIP
if you don't attach the EIP every time when you will restart the server you get a new instance IP.
Also, you have to check the security group applied on that instance.

ec2 Instance refused to connect in browser

I have created my ec2 instance successfully in AWS.
here my instance end point is ec2-18-222-211-176.us-east-2.compute.amazonaws.com
The problem is when I try to hit this end point it is showing refused to connect. I don't have any Idea why it is not working like this
where as I successfully connect instance using SSH key, here it is working fine.
here my instance security group inbound rules are listed below
Looks like it is working on both the DNS and the public IP http://18.222.211.176
It was the Apache web server not running. To find this, type this from your root#ip directory:
service httpd status
To start the server, type:
service httpd start

PuTTy Connection timed out for EC2

I created Ubuntu instance in EC2. And worked fine so far.
But somehow I can't connect to the server by PuTTy anymore and I get Network error: Connection timed out.
The instance is running in the console.
CPU uses just 2%.
InBound Setting seems no problem. SSH with 22 port.
Tried with the IP address and DNS.
restarted the instance and Tried.
Stopped and tried with different IP address.
Instance connection is fine.
This is the screenshot:
This is inbound rule:
How can I solve this problem?
A Connection timeout is a sign that your computer is unable reach the remote computer. Such an error normally takes some time before it fails.
If, instead, the remote computer rejected the connection, the error would appear immediately and the message would be Permission denied.
Things to check:
The Security Group on the EC2 instance needs to allow inbound SSH (port 22) access either from the whole internet (0.0.0.0/0) or, preferably, from a smaller CIDR range that includes your computer (eg choosing "My IP" in the console). This is typically the cause of the issue 80% of the time.
The instance needs to be in a Public Subnet, which means the subnet is connected to an Internet Gateway.
Your network must allow an outbound SSH connection to AWS. Some corporate networks might block this.
There are some other potential causes, but most of the time the cause is one of the above.

Cannot SSH to Amazon EC2 instance from ubuntu 14.04 LTS

I followed everything in exact same order as refered here :Amazon Set Up Documentation. I also read many SO answers but everyone suggested on checking the security group and route tables. I did everything none of them helped.
I have a USB Dongle which I use to surf internet. Its IP changes everytime I disconnect the dongle and reconnect it. But if I stay connected its IP remains same. So I did created a security group my_ip/32 and launched an ec2 instance. So without disconnecting my dongle i.e keeping my IP intact I tried to connect to the instance through SSH with simple
ssh -v -i my-key-pair.pem user#public_dns
command but with no luck.
But the funny thing is I can connect to the ec2 instance if I change my security group to 0.0.0.0/0 which is not suggested by amazon because of security issue.
Does anybody has faced the similar situation. Or Amazon did miss something in their documentation.
NOTE:
I also enable firewall in ubuntu for ssh as follows:
sudo ufw allow ssh/tcp
sudo ufw enable
Am I missing something??
When you google 'what is my ip' does it give you the result you expected for my_ip? Google will report back the IP the outside world sees you as.
I have a feeling you might be going through a NAT router which you're recieving DHCP from, as such you're dongles IP isn't even being seen by EC2 to match a security group.