Ec2 instance connection timed out but can be pinged

amazon ec2amazon-elastic-ipamazon-route53amazon-web-servicesconnection

I've seen many similar questions but none like this.

So I started an ec2 instance and installed apache, WordPress, etc on top. And I was able to access everything fine with the public IP provided to me.

Then I created a hosted zone on route 53 to redirect my domain to this instance. This worked, but I wanted to create an elastic IP to associate with my instance.

As soon as it associated I can no longer access my instance.

I can ping, ssh to my instance no problem. However, when accessing the Elastic IP or public DNS using a browser, it just hangs there for seconds and shows connection timed out. Security rule allows all the HTTP https ssh ICMP etc.

I thought it could be the server's problem, but when I ssh to instance it shows httpd is running fine.

I have deleted the hosted space, got a new elastic IP to associate, restart the instance, but at no point did the server become accessible. Short of making a new instance.

So I'm stuck here and would appreciate any help possible. If it helps this is the instance ID: i-09fcc30eb8776b7fe

Thank you

edit: attaching screenshot of my instance and my security group rules

http://i.imgur.com/rVg6xoy.png

http://i.imgur.com/wIieG70.png

for security group rules, when I select the source as "anywhere", it auto-populates 0.0.0.0/0::/0, and the next time I go in it becomes 2 rules.

Best Answer

With the advice from Tim, I ran curl -i address, finding that it shows 301 moved permanently.

Upon closer inspection, when I access the new public dns/elastic ip, it is still trying to connect to my old public ip which fails.

I created a new instance based on the image but when accessing the new instance public ip/elastic ip it still tries to connect to the old public ip.

In the end I created a new instance completely from scratch. This time I associate the elastic ip first, then redirect domain to the instance and everything worked.

(atm the browser still cant access my domain name because the ip is cached i think. opening in private/incognito and i see that it works. )