Deploy NodeJs Server On AWS Lightsail
In this blog post , We will see how to deploy node.js server to aws lightsail.
If you would like to Setup LEMP Stack (Linux , Nginx , MySQL & PHP) on Ubuntu , Refer this Article
What Is Node.Js?
Node.js is a server-side platform built on Google Chrome’s JavaScript Engine (V8 Engine).It is an open source, cross-platform runtime environment for developing server-side and networking applications.
Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast and scalable network applications.
Node.js applications are written in JavaScript, and can be run within the Node.js runtime on OS X, Microsoft Windows, and Linux.
It uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
Node.js also provides a rich library of various JavaScript modules which simplifies the development of web applications using Node.js to a great extent.
Setting UP Node.Js Server
Amazon offers a one click software deployment features along with the Operating system.We can launch an Instance which comes up with a tools such as WordPress , OpenVPN server etc.
But In this tutorial , We are going to deploy Node.js server , Which is the combination of App and OS using the Lightsail service.
Lets understand the basics of lightsail before deploying the Node.js on it.
What Is Lightsail?
If you dont have much experience with Amazon Web Services such as VPC , EC2 Instances , Load Balancers , Amazon Lightsail is the best and easy way to start.

It provides a quick and easy way to deploy and mange instances along with appllications such as WordPress , LAMP stack , Drupal and much more.
This features is mainly for developers who want to setup a test project to run applications without having much knowledge on managing aws services and also to avoid spending time on installing software or frameworks.
Deploying Node.Js Server
To setup Node.js , Login to Lightsail Console
You should see the following page.

Click Create instance,
Choosing Instance Location
We have to choose the Instance location , For example , I chose Mumbai

Also You should choose the Availability Zone.

Choosing Instance Image
Now We have to choose the Operating system , From these two Platforms: Linux and Windows.
If you select Linux/Unix , and If you choose OS only ,You have the option to select one of the following operating systems.

But In this tutorial , As we are Deploying Node.js server as a One click software deployment , We choose Apps + OS and then select Node.js

And Optionally You can add the shell scripts which will run while the instance boots up.
Under SSH Key pair manager , You can use exiting key pair Or you can create one If you want.
To create a New key pair for this instance , Click Create New
And Click Create ,

Type the name for the Key Pair and Download the .pem file.


Choosing Instance Plan
You can choose the Instance plan such as RAM , CPU and HardDisk based on your requirement.

Provide a name for the Instance , and then add tagging for grouping the resources.


At last , Click Create instance.
Once the Instance is Created and Running.
If you click the console icon , You will see the below error.

Lightsail asks us to give a couple of minutes before SSH into the Instance.
After a minutes or two , If you click the Console icon again , You should be able login to the Instance.
Once logged into the Instance , We can check the lists of services installed and running using the below command.
netstat -nltp
From the below screenshot , We can see that the Redis database and the Apache web server is running.

If you copy and paste the Public IP Address of the Instance in the browser address bar , You will see this page.

This is due to some sample web pages already installed under /opt/bitnami/apache2/htdocs folder in the Instance.
Conclusion
We have successfully deployed a Nodejs server on AWS using Lightsail service.
Hope this article helps.Thanks for reading this article.
Please do check out my other publications.