0 votes
1 view
in AWS by (12.9k points)

I'm interested in hosting nodejs applications in a cloud and I'm looking for a free cloud hosting for my purpose. I've found that Amazon has one but I have the following question: Are there any tutorials around how I can set up and run nodejs application in Amazon EC2?

1 Answer

0 votes
by (18.6k points)

Below mentioned are some general steps that you can follow to host a basic Node.js application running on EC2 Ubuntu instance:

1. launch an instance and SSH into it

2. Install Node.js using the following command:

sudo apt-get install nodejs

3. create a file named test_server.js with the following content:

require("http").createServer(function(request, response){

response.writeHeader(200, {"Content-Type": "text/plain"});  

response.write("Hello World!");  



4. Start the server using the following command:

node test_server.js

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !