Deploying Node.js on Amazon EC2

Node.js application deployment on EC2 : 

1. Create an EC2 instance.

2.Connect to your EC2 instance

ex: ssh -i <your-key.pem> ec2-user@<your-ec2-public-ip>

Step 1:  Install NodeJS & NPM using nvm : 

please run these command to deploy node js application -->

1.  sudo su -

2.  curl -o- | bash

Activate NVM

3.  . ~/.nvm/
install node js latest version-->

4.   nvm install node

Install Git :

5.   sudo apt-get update -y

6.   sudo apt-get install git -y

Run below command to clone repository from Github:

7.  git clone

inside directory install package : 

8 . cd file-uploadNode

9.   npm install

10. npm start

Run following command to run app as background : 

11.  sudo npm install -g pm2

12. sudo pm2 install pm2-logrotate

13. sudo pm2 start app.js --name node-app

check status of the application using command

14. sudo pm2 logs <node-app start id>

Thank you Guys if you have any doubt please comment we will try to help you As soon as possiable.
Happy Coding !


Post a Comment