Search code examples
amazon-web-servicesamazon-ec2meanbitnami

remove port no 3000 requirement from aws ec2 instance


I have hosted my MEAN project over aws ec2 (mean bitnami hvm) instance. It is running on port 3000 and I am able to access my instance in the following way: ec2-xx-xx-xx-xx.amazonaws.com:3000

I want to access the instance without the port number (3000), i.e.: ec2-xx-xx-xx-xx.amazonaws.com

How can I do this?


Solution

  • Run this port forward command on your EC2 instance.

    sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000
    

    And your port 80 will be redirected to port 3000.