Amazon EC2 Tutorial : Hosting Mean Stack Application

Sunday, January 5, 2020

Amazon EC2 Tutorial : Hosting Mean Stack Application



Amazon EC2 is one of the most used and most basic services in Amazons so it makes sense to start with EC2 when you are new to AWS. But the first question is that what is EC2 in AWS ?


AMAZON EC2 HOSTING MEAN STACK APPLICATION
AMAZON EC2 HOSTING MEAN STACK APPLICATION


1. What is EC2 in AWS ?


Well to be very simple, 


  1. It's basically virtual machine which includes CPU, RAM, ROM e.t.c
  2. It also allows to choose different platform ( like windows, linux, ubuntu e.t.c ) while you are launching virtual machine in cloud. 
  3. The Virtual machine we called it as an instance, you can easily start, stop or terminate your instance.


2. AWS EC2 Mean Stack Application Screens?


I am sharing few screens about out Mean Stack Applications that we are going to host it in AWS EC2. 

Insert - 

Mean Stack Crud Application Insert
Mean Stack CRUD Application Insert

Update -

Mean Stack Crud Application Update
Mean Stack CRUD Application Update

Delete -

Mean Stack Crud Application Delete
Mean Stack CRUD Application Delete

3. Architecture of the Mean Stack Application

    In the below diagram, this is the architecture of our mean stack application that we are going to setting up in 2 AWS instance. In the FrontEnd Part I am using Angular 6, and

MEAN STACK APPLICATION ARCHITECTURE
MEAN STACK APPLICATION ARCHITECTURE

whatever user interaction got happened like create, read, write and delete it's happening from Node JS. So Node Js is act as a mediator which helps to talk to my database mongo DB and get back the data to frontend. So we will be going to use 2 instance 1 for frontend and 1 for backend.

Mean Stack FrontEnd Project Link - 

Mean Stack BackEnd Project Link -

If you want to learn more about Mean Stack please visit my blog - 

My youtube - Mean Stack Tutorial



About the AMAZON EC2 Tutorial also you can see - 



2. Installation of MongoDB into AWS EC2 Instance

First if you have not registered in AWS please register first. Then launch an UBUNTU instance. Download the pem key. Open your terminal - 

ssh -i yourkey.pem ubuntu@your_ec2_public_ip

Once you have logged in then follow the below process,

For Installation of MongoDB please visit the below link - 



More details -

You can also see my below videos - 


3. AWS EC2 Hosting Mean Stack Application using PM2 - 


This is the other ubuntu Instance that we are launching it. First thing we need to install Node JS, Angular 6, NVM and PM2 in the AWS EC2 instance. Then we have to clone the code inside the EC2 instance. 

Install Node JS - 

sudo apt update
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs 

Install NVM for changing the Node JS version -


nvm ls-remote 

Install Angular 6 -
sudo npm install -g @angular/cli@6.0.7

Mean Stack FrontEnd Project Link - 

Mean Stack BackEnd Project Link -
git clone https://atique12@bitbucket.org/atique12/mongocrud_application_back_end.git 

Then edit the file - 

Mean Stack BackEnd Project - db.js and index.js - Instead of Localhost put first instance mongo DB EC2 Public ip to db.js and 2nd instance public ip to 2nd EC2 instance.

Mean Stack FrontEnd Project - Inside src/app/shared

vi person.services.ts

Change localhost to 2nd AWS EC@ public ip.

You can also Visit my youtube video for more details - 





Thank you guyz.

Please don't forgot to subscribe my youtube channel.


6 comments :

markson said...

It is commonly confounded to plainly characterize explicitly what the best web facilitating truth be told is however there are a couple of rules it is not difficult to stay with that can assist you with discovering what the best web facilitating is https://onohosting.com/intended for your necessities.

priya said...

your content is very inspiring and appriciating I really like it please visit my site for Satta King Result also check Satta king 24X7 and also check sattaking and for quick result check my site Satta matka and for super fast result check Satta king

Singapore citizenship said...

This article provides good overview of motives of Singapore Workpass Application

ashish said...

The best MEAN Stack Training in Gurgaon offer hands-on experience with real-world projects, so you can gain practical experience and build a strong foundation in MEAN stack. In addition, many training institutes offer job placement assistance to help students find jobs after completing their training

Zoopup official said...


I'm delighted to discover this post immensely valuable, given its wealth of information. I consistently prioritize reading high-quality content, and I've certainly found that in your post. Thank you for sharing. ZoopUp.

Amitsaha said...

Unlock the full potential of JavaScript with APTRON Gurgaon's comprehensive NodeJs Course in Gurgaon. Designed for both beginners and experienced developers, this course provides hands-on training in building scalable, fast, and real-time web applications. Whether you are looking to enhance your skillset or start a career in backend development, APTRON Gurgaon ensures you are industry-ready with expert guidance and practical exposure.