I have a AWS EC2 instance running and I am supposed to access the localhost URL of the instance. Whenever I try the localhost:port/index.html URL I get a server not responding error. I tried using the public IP of the instance instead, but that failed. I configured AWS by exposing the particular port number for the inbound traffic (IP : 0.0.0.0/0) that did not work either. How should I configure so that I can access the URL?
Asked
Active
Viewed 9,159 times
-1
-
Hi! Can you please provide more information? For example, what service are you running on the EC2 instance that you want to connect to -- is it a web server on port 80? Are you trying to access it from the instance itself, or from a remote computer on the Internet? Have you tried accessing it from the instance itself to confirm that the web server is running? – John Rotenstein May 04 '16 at 05:12
-
Yes the service is running on a web server (on EC2) but not on port 80, the http URL is - http://localhost:45984/index.html (port number variable). I am trying to access on the local machine (Mac, version is OS X 10.11.4). I know that the service is actually running on the EC2 instance itself, because when I use a tool like curl on the EC2 terminal for the particular URL I am getting a response, not something like "The server is not responding" which I get when I try to access the service remotely i.e. from the local machine. When I replace localhost with public IP of EC2, it is not working. – user4002112 May 04 '16 at 14:48
1 Answers
0
If a service is running at localhost:45984 on an EC2 instance, you cannot access that server from your browser on your local machine unless you employ port forwarding.
Here's a good article that explains the different concepts:
https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding
I believe what you want is local port forwarding, where you set up a tunnel so that you can access "localhost:45984" on your EC2 instance from some port you specify on your Mac.

Evan Samanas
- 516
- 3
- 6