unable to access localhost URL of AWS from local machine

user4002112 picture user4002112 · May 4, 2016 · Viewed 7.6k times · Source

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?

Answer

Evan Samanas picture Evan Samanas · May 4, 2016

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.