Search code examples
node.jsamazon-web-servicesamazon-ec2aws-security-group

Serve node Webapp on port 80 in amazon ec2


I have a node application listening on port 80, I have set the security groups open on port 80. enter image description here

But, when I access my webapp in browser via public ip(http://xx.xxx.xx.xxx/), it doesn't show up.

What could be the issue?

I've use this doc as a guide https://aws.amazon.com/premiumsupport/knowledge-center/connect-http-https-ec2/


Solution

  • When your security group already allowed traffic It means something wrong with the instance.

    The first step to debug such an issue to verify the application status inside the instance.

    • do ssh to the instance and verify is the instance responding on localhost curl localhost
    • check is the process running, if you are using any nodejs process manager like pm2 pm2 list or forever forever list or ps -aux | grep node
    • Verify is the server running on port 80.
    • check is the port occupied netstat -antu | grep LISTEN

    In short, if the application responding on localhost using curl localhost, then as mentioned in the comment then the instance is in the private subnet.

    you can check this article to know about public and private subnet.