How to Install Nodejs in AWS EC2 in a proper way

In this article, we will see how to install nodejs in AWS EC2 instance in a proper way. How to Install Nodejs in AWS EC2 in a proper way.

Recent Articles

Building Real time API using graphql subscriptions

Introduction to AWS SNS using Nodejs

Building Modern Nodejs Application using Nestjs and TypeScript

Before proceeding further, i assume that you have basic understanding of what is AWS EC2 and some of AWS concepts. read this article to know more about AWS EC2

If you are already familiar with AWS EC2, you can skip the below part and go to the installing nodejs part of this article.

AWS EC2 Setup

Create an account in AWS and go to EC2 in the aws Dashboard. In the AWS EC2 dashboard, you can see a launch instance button,

dashboard

click on the launch instance button and it will ask you to select the virtual instance operating system and storage.

storage

Select any free tier instance (operating system) that you want, and continue the process.

After that, it will ask you to select the type of instance that you want for your server.

instace type

Once you click the launch, you need to review all the configuration that you have selected and generate the key value pair,

key gen

if you already have aws key, you can use the existing key for this server also, Or else you can create a new one.

Remember, this key should be shared with anyone else under any circumstance. also, make sure you do not lose the key. that's very important.

After completing the process, you're ec2 instance will be ready.

Now, it is time to install the nodejs in the aws ec2.

Installing Nodejs in AWS EC2

Mainly, we will be using nvm to install and manage nodejs. important feature of nvm is we can upgrade and downgrade nodejs easily using nvm.

Let's install nvm in AWS EC2 using the command

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

it will install the nvm in our ec2 instance.

install nvm

After that,you need to activate the nvm to use it. activate the nvm using the command,

1. ~/.nvm/nvm.sh

avtivate nvm

Now, use nvm to install the nodejs on ec2 instance

1nvm install node

install node

Node is installed successfully on the instance. you can test the nodejs byb checking the version of nodejs and npm.

verify install

Summary

To sum up, it installs the nodejs on AWS ec2 instance. important thing to note here is, you can upgrade the nodejs version easily using nvm.

To Read More

Kubernetes for Nodejs developers

Do you keep hearing the word kubernetes in the tech community and you couldn't u...

TypeScript Interfaces vs Types

In this article, we will see what are interfaces and types and the difference be...

How to find project ideas to practi...

Ever wondered what how to get a real world experience on web development while w...

Building a Production-grade Nodejs,...

This article is the first part of building a production grade nodejs,graphql and...

Modern React Redux Tutorials with R...

This tutorial explain how you can build an application using modern react redux ...

Building a Piano with React Hooks

In this article, we will see how to build a piano with react hooks. Building a P...

TypeScript Basics - The Definitive ...

In this article, we will learn some basics of typescript which helps you to deve...

Here's why podman is more secured t...

In this article we will see about podman and why it is more secured way to run c...

What is gRPC ? How to implement gRP...

Everyone talks about gRPC. Have you ever wonder how it works or how to implement...