Follow below steps to set up new NodeJs application on AWS EC2 instance:
1. AWS - Create new instace (Download .pem file)
2. Connect EC2 install using .pem file (sudo ssh -i <.pem file full path> ubuntu@<instace Public IPv4 address>)
2. Install nginx (sudo apt install nginx)
3. Install NodeJs (sudo apt install nodejs)
4. Install NPM (sudo apt install npm)
5. Install postgreSQL (sudo apt install postgresql postgresql-contrib)
6. Allow port(5432) for postgreSQL: Goto > instace > Security > Security Groups > Edit inbound rules > Add rule
6. Install git (sudo apt-get install git)
7. Install pm2 to run Node application (https://www.npmjs.com/package/pm2)
8. Now server ready to used you need to get git clone of your project repository.
Enjoy!