M. Page
M. Page

Reputation: 2814

Accessing Python webserver remotely on Amazon EC2

I work on a project in which I need a python web server. This project is hosted on Amazon EC2 (ubuntu). I have made two unsuccessful attempts so far:

  1. run python -m SimpleHTTPServer 8080. It works if I launch a browser on the EC2 instance and head to localhost:8080 or <ec2-public-IP>:8080. However I can't access the server from a browser on a remote machine (using <ec2-public-IP>:8080).

  2. create a python class which allows me to specify both the IP address and port to serve files. Same problem as 1.

There are several questions on SO concerning Python web server on EC2, but none seems to answer my question: what should I do in order to access the python web server remotely ?

One more point: I don't want to use a Python web framework (Django or anything else): I'll use the web server to build a kind of REST API, not for serving HTML content.

Upvotes: 4

Views: 2421

Answers (2)

magigo
magigo

Reputation: 176

you should open the 8080 port and ip limitation in security croups, such as:

All TCP TCP 0 - 65535 0.0.0.0/0

the last item means this server will accept every request from any ip and port, you also

Upvotes: 6

Mason.Sun
Mason.Sun

Reputation: 71

You passble need to IAM in AWS. Aws set security permission that need to open up port so you only localhost links your webservice aws link

Upvotes: -2

Related Questions