Here, In this tutorial, we'll walk you through each step of the process, from setting up your EC2 instance to configuring security groups and deploying your Node.js app. Follow along with our clear, easy-to-follow instructions, and by the end of this video, you'll have your Node.js app up and running on EC2 in no time. Don't forget to like, comment, and subscribe for more tutorials on cloud computing, Node.js, and AWS! Let's dive in and get started. Steps: Pre-requisite: Create your free trial AWS login Commit your code to GitHub Create EC2 instance: Create an EC2 instance. Basically t2-micro ubuntu Connect to your EC2 instance Trigger sudo apt update to install any update if available Install node js version 18: sudo apt install nodejs node -v npm -v Verify if GIT and clone your project git --version git clone YOUR_PROJECT_REPOSITORY_URL Project configuration: Go inside your project folder: cd youtubeCode Trigger command "npm install" to create the node_module folder Verify node_module folder by command "ls" Install Process Manager(PM2) library at global level. sudo npm install -g pm2 Then go to your project folder pm2 start app.js pm2 logs pm2 reload all Now you can visit your api in browser: http://IP:Port/routeName Install nginx and configure: sudo apt install nginx sudo vim etc/nginx/sites-available/default server_name 54.206.158.160; location / { proxy_pass http://localhost:3001; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } Press ctrl+c and type :wq! to write and quit # Check NGINX config sudo nginx -t # Restart NGINX sudo nginx -s reload # System Nginx start stop sudo systemctl stop nginx sudo systemctl start nginx
Here, In this tutorial, we'll walk you through each step of the process, from setting up your EC2 instance to configuring security groups and deploying your Node.js app. Follow along with our clear, easy-to-follow instructions, and by the end of this video, you'll have your Node.js app up and running on EC2 in no time. Don't forget to like, comment, and subscribe for more tutorials on cloud computing, Node.js, and AWS! Let's dive in and get started. Steps: Pre-requisite: Create your free trial AWS login Commit your code to GitHub Create EC2 instance: Create an EC2 instance. Basically t2-micro ubuntu Connect to your EC2 instance Trigger sudo apt update to install any update if available Install node js version 18: sudo apt install nodejs node -v npm -v Verify if GIT and clone your project git --version git clone YOUR_PROJECT_REPOSITORY_URL Project configuration: Go inside your project folder: cd youtubeCode Trigger command "npm install" to create the node_module folder Verify node_module folder by command "ls" Install Process Manager(PM2) library at global level. sudo npm install -g pm2 Then go to your project folder pm2 start app.js pm2 logs pm2 reload all Now you can visit your api in browser: http://IP:Port/routeName Install nginx and configure: sudo apt install nginx sudo vim etc/nginx/sites-available/default server_name 54.206.158.160; location / { proxy_pass http://localhost:3001; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } Press ctrl+c and type :wq! to write and quit # Check NGINX config sudo nginx -t # Restart NGINX sudo nginx -s reload # System Nginx start stop sudo systemctl stop nginx sudo systemctl start nginx