Accessing a Remote Python Web Server on Amazon EC2
I am working on a project where I need a python web server. This project is hosted on Amazon EC2 (ubuntu). I made two unsuccessful attempts:
-
run
python -m SimpleHTTPServer 8080
. It works if I launch a browser on an EC2 instance and go to localhost: 8080 or <ec2-public-IP>: 8080. However, I cannot access the server from the browser on the remote machine (using <ec2-public-IP>: 8080). -
create a python class that allows me to specify both an IP address and a port for serving files. Same problem as 1.
There are several questions on SO regarding the Python web server on EC2, but none seem to answer my question: What should I do to remotely access the python web server?
One more point: I don't want to use the Python web framework (Django or whatever): I will be using the web server to create a kind of REST API, not to host HTML content.
source to share