DEV Community

Cover image for Deploy NodeJS APP on AWS EC2 Instance
Lokeshwar Rajan
Lokeshwar Rajan

Posted on • Edited on

Deploy NodeJS APP on AWS EC2 Instance

Description:

In this hands-on project, I demonstrate how to deploy a simple Node.js application to the cloud. This project is ideal for testing basic deployments and understanding the fundamental steps involved in setting up a Node.js app on a server. The guide covers the installation of Node.js and npm using nvm, setting up Git, cloning the repository, and running the application.

Here's Step by Step Guide:

Step 1: Launch an EC2 Instance with a Ubuntu OS and necessary requirements and specified ports.

Step 2: Connect the Instance with EC2 Instance Connect.

Step 3: Install NodeJS and NPM using nvm

sudo su -
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

Enter fullscreen mode Exit fullscreen mode

Step 4: Install Node.js and Verify Installation.

nvm install node
node -v
npm -v

Enter fullscreen mode Exit fullscreen mode

Step 5: Install the git and clone the repository.

apt-get update -y
apt-get install git -y
git clone https://github.com/Lokeshwar-Rajan/nodejs-on-ec2.git

Enter fullscreen mode Exit fullscreen mode

Step 6: And then install the necessary packages and start the application.

npm install
npm start

Enter fullscreen mode Exit fullscreen mode

Step 7: Now copy the public IPv4 and Test the sample node.js app.

Proof of Concept:

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Thanks for Reading...

Top comments (0)

The only thing worse than downtime? No Answers.

If you’re sometimes frustrated with opaque infrastructure, sluggish support, and mysterious outages, we prepared a webinar just for you

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️