2

I can ssh to my EC2 instance and start a web server on it:

$ ssh -i ~/AWSKeyPair1.pem ec2-user@54.210.10.190
Last login: Mon Jul 20 18:50:58 2015 from 72-21-196-64.amazon.com

       __|  __|_  )
       _|  (     /   Amazon Linux AMI
      ___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2015.03-release-notes/
$ echo 'Hello world' > index.html
$ sudo service iptables status
iptables: Firewall is not running.
$ python -m SimpleHTTPServer 8888
Serving HTTP on 0.0.0.0 port 8888 ...

And curl it from the instance

$ curl 54.210.10.190:8888
Hello world

But curls from my laptop fail

$ curl 54.210.10.190:8888
curl: (7) Failed to connect to 54.210.10.190 port 8888: Connection refused

Why might this be? My Security Groups are set to allow all traffic from anywhere (0.0.0.0/0), and my Route Table routes all traffic to the appropriate gateway.

(Previous question)

2
  • $ sudo netstat -a -n | grep 8888 from another terminal while the web server is running. What does it show? Jul 20, 2015 at 22:02
  • Incidentally, this works from my mobile phone. Possibly an issue with your laptop or the network your laptop is on? Jul 20, 2015 at 22:04

2 Answers 2

1

Make sure you have your AWS security groups are setup to allow access at 0.0.0.0/0 port 8888 using a custom TCP rule.

verify your local network firewall allows outbound connections to port 8888.

0
1

In my case the python server running on the aws instance was only listening (and serving) to localhost or 127.0.0.1 / interface. Thus it will ignore connections from the outside. For me starting the python server on 0.0.0.0 worked. From the output you printed it looks like, it already does - but might be worth a shot or help others

1
  • dude you are a life saver i totally forgot to remove localhost! Thanks Dec 24, 2021 at 1:25

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.