I have a web application running on Amazon EC2. It listens on port 9898.

I can access it by entering the ip address and port number.

e.g 1.2.3.4:9898

However, what I'd really like to be able to do is to not have to enter the port number.

Researching this, it looks like port forwarding might be the solution - i.e. forward http requests received on the default port (80) to my non-standard port (9898).

Is this the correct way to go? If so, how do I set this up on EC2?

If not, then how do I achieve what I want?

Thanks in advance for any help.

Update

I should have mentioned the EC2 instance is a Windows Server 2012 AMI.


The easiest way to do this without installing something yourself is putting an Amazon Elastic Load Balancer in front of the instance. These allow you to forward ports as you intend.


You have two options.

1) Set up a reverse proxy to forward the HTTP requests (assuming it's HTTP) to a different port.

It should be as simple as: Install apache, enable the proxy_http module, put something like:

ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
    Order allow,deny
    Allow from all
</Proxy>
ProxyPass / http://localhost:9898/
ProxyPassReverse / http://localhost:9898/

2) Set up IP Tables to forward the packets.