Centos – Cannot access website running on port 8888 at AWS EC2 instance

amazon ec2centossecurity-groupsssh-tunnel

I am running an EC2 instance with AWS Linux. There is a website running there on port 8888, so if from the VM I run curl "http://127.0.0.1:8888/login" I receive the website.

I want to access it from outside, so I set up a rule in the security group attached to the instance:

Custom TCP Rule  TCP  8888  0.0.0.0/0

When I tried to access it from my browser or command line, I get a timeout

curl "http://xx.yy.zz.ff:8888/login"

Where xx.yy.zz.ff is the elastic IP attached to the instance (which I use to connect to the VM via SSH).

Interestingly, I can access it on http://localhost:8888/login if I do SSH tunnelling first:

ssh -i my-key.pem -NL 8888:localhost:8888 me@xx.yy.zz.ff

If I do sudo netstat -tulpn I get

tcp    0      0     127.0.0.1:8888   0.0.0.0:*     LISTEN      26531/python

And If I do sudo ss -aut | grep 8888 I get nothing at all.

Any ideas?

Best Answer

tcp    0      0     127.0.0.1:8888   0.0.0.0:*     LISTEN      26531/python

Well, there's your answer. Your webserver (python process) is only listening on your localhost interface. So you'll either need to reconfigure that to listen on your EC2's external network interface or install nginx to use as a reverse proxy.