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



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

  • Check your instance firewall. – user9517 Mar 11 '17 at 7:37
  • I assume you mean the security group? there is no firewall options. For security group as i have said, it allows http (80), https (443), ssh (22) and icmp. – flowintent Mar 11 '17 at 7:45
  • There are differences between an Elastic IP address that you use in a VPC and one that you use in EC2-Classic. For more information, see docs.aws.amazon.com/AWSEC2/latest/UserGuide/… – Saurabh Pandey Mar 11 '17 at 8:39
  • Assigning an elastic IP to an instances removes the existing public IP. Make sure you're using the elastic IP address - you probably are, but have to rule it out. Please edit your question to include a screenshot of your security groups and NACLs. It'll be something really simple, but sometimes finding that simple thing takes a bit of work. I have a basic secueity gruop setup screenshot on a tutorial here, two pages down photographerstechsupport.com/tutorials/… – Tim Mar 11 '17 at 8:39
  • i edited the question to include screenshots. But not sure where i can find Network ACL. I did use the elastic ip. – flowintent Mar 11 '17 at 10:41

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. )


To allow an instance reachable on a particular port over the internet you have to make the following considerations.

  1. Make sure the instance is having a public IP address, this can be your elastic IP or a dynamic public IP provided by Amazon when you opt for it at the time of instance launch.
  2. The instance security group must allow the specific port from the internet where the source becomes - for IPv4 and ::/0 For IPv6 respectively
  3. If you are using NACL then you should also allow the specific inbound port and allow the ephemeral port range in the outbound. This is because NACL is stateless. Please check here for recommended NACL rules for your VPC

  4. Lastly you have to make sure the subnet in which this instance is launched has a route to the internet gateway (IGW). You may review the route table entries associated with the subnet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.