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- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

Activate NVM

3.  . ~/.nvm/nvm.sh
 
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 https://github.com/vakilsingh12/file-uploadNode.git


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 !






Comments

Post a Comment

Popular Posts

Int 242 Mcqs Cyber Security Essentials (Mcqs )Multiple Choice Questions Practice Questions

CSE 423 Virtualization and Cloud Computing

Cse 427 Cloud Computing Lab (VIRTUALIZATION AND CLOUD COMPUTING LABORATORY)

Cyber Security(INT 242) root@csenotes12:~#

CSE 322 ETE End Term Paper Autoamta Formal Languages and Automata Theory

INT 244 :: SECURING COMPUTING SYSTEMS