0

I have 2 instances set up in EC2. One is running nginx and has an association with the elastic IP address, so its publicly accessible.

The other doesn't have a web server but has a RESTful server running on port 8080.

Both belong to a security group with these rules:

Ports   Protocol    Source  MongoDB-2-2-2-AutogenByAWSMP-
22  tcp 0.0.0.0/0   
80  tcp 0.0.0.0/0   
8080    tcp 0.0.0.0/0

If I understand that right then port 8080 should be open.

If I ssh onto my web box (with nginx running) I'm trying to test access to my RESTful server on the other instance:8080, so I tried:

curl http://10.151.87.76:8080/1/tlc/ping
curl http://ip-10-151-87-76:8080/1/tlc/ping
curl http://ip-10-151-87-76.ec2.internal:8080/1/tlc/ping

All of these gave me "couldn't connect to host" errors.

If I log onto the RESTful box directly and do the following, it works.

curl localhost:8080/1/tlc/ping

So I know my service is up and healthy.

Any ideas why I can't see port 8080 from the other instance are appreciated.

2 Answers 2

1

Make sure instances are in the same availability zone. If not, you may need to access the instance by public DNS name (something like ec2-XXX-XX-XXX-XXX.YYY.amazonaws.com).

Make sure 10.151.87.76 is the correct IP. Note that this will probably change after the instance is stopped and started again.

Make sure your headless service is publicly available -- it may listen on localhost:8080 only but should listen on 0.0.0.0:8080. Try nmap 10.151.87.76 -p 8080 from other instance, it should list 8080 as open port.

4
  • Same availability zone: Yes IP Check: These are correct nmap said this: Nmap scan report for ip-10-151-87-76.ec2.internal (10.151.87.76) Host is up (0.00053s latency). PORT STATE SERVICE 8080/tcp closed http-proxy So it is closed on the web box even though the security policy said it was supposed to be open. How to I overcome this?
    – Greg
    Apr 16, 2013 at 23:09
  • 1
    > Make sure your headless service is publicly available << so this is the reason. What web server are you using for REST API? If it is Apache, make sure config says Listen 8080, not Listen 1.2.3.4:8080. If it is standalone app, make sure it can listen on all interfaces -- some clients will listen on localhost by default.
    – hudolejev
    Apr 16, 2013 at 23:18
  • nmap state=closed means that port is open in firewall but no service is running. If it were closed in firewall, the result would be state=filtered.
    – hudolejev
    Apr 16, 2013 at 23:23
  • Instead of 'some clients' I actually meant 'some servers' (:
    – hudolejev
    Apr 17, 2013 at 0:14
0

Make sure your headless service is publicly available << so this is the reason. What web server are you using for REST API? If it is Apache, make sure config says Listen 8080, not Listen 1.2.3.4:8080. If it is standalone app, make sure it can listen on all interfaces -- some clients will listen on localhost by default. – hudolejev 54 mins ago

This! Buried deep (deep) within my code was a piece of the server wired to "localhost". Changed that to key off hostname and all was well! Happy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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