DEV Community

Cover image for Complete Setup for Deploying Nodejs App with mongodb database on Amazon ec2

Complete Setup for Deploying Nodejs App with mongodb database on Amazon ec2

Sunil More on May 31, 2019

Intro There are many ways to run the server and there are plenty of cloud platform option available in the market. But most famous cloud...
Collapse
 
ganekasar profile image
Ganesh Kasar

I am not able to access the port from the browser. I have followed all the steps correctly. I am not able to find what's the issue. Can anyone help me please?

Collapse
 
sunilmore690 profile image
Sunil More

Hi

Please make sure whatever port accessible from browser, you've added this port in EC2 inbound rule with type http access from anywhere

Collapse
 
krishnay2000 profile image
Krishnaraj Yadav

Did you find how to connect . I am facing the same issue .

Collapse
 
rishabk7 profile image
Rishab Kumar

👏👏👏

Collapse
 
rafiandria23 profile image
Adam Rafiandri

Awesome!

Collapse
 
wojtekmaj profile image
Wojciech Maj

Any idea on how to expose 27017 port to the outer world? I'm struggling with remote connection to the database :(

Collapse
 
sunilmore690 profile image
Sunil More • Edited

You need to set inbound rule for port 27017 to make public for ec2 instance

Collapse
 
kameshkarthi profile image
kameshkarthi

How edit app.js in vscode? or where the files are stored?

Collapse
 
sunilmore690 profile image
Sunil More

You need to use vi to edit app.js as you can access ec2 instance only through terminal

Collapse
 
kameshkarthi profile image
kameshkarthi

Thank you for your reply....how to push changes in code without restarting server(app.js)???

Thread Thread
 
sunilmore690 profile image
Sunil More

Hi

I don't think so it's valid scenario and it's not possible

As if you did some code changes , to reflect those changes you need restart the server

According to me there is no way to push changes in code without restarting except if static data like images,css etc

Collapse
 
kameshkarthi profile image
kameshkarthi

How to configure this ec2 instance with elastic load balancer?