how to make nodejs server available online from aws win - node.js

I have aws windows server 64bit
installed nodejs on it
uploaded nodejs project
run node server.js
on aws i can access my node application on url localhost:8080
i want to make it available online
in windows firewall every thing is green
I have created new inbound rule for port 8080 and allowed that is also green

You need to modify the instance's security group to permit inbound connections on port 8080. A security group acts as a virtual firewall for the instances associated with it. By default no inbound connections are permitted.

Related

How to communicate with the nodeJS server setup in the Google cloud virtual machines(Windows server) through internet?

I am developing a chat app in android using soocket.io. This app needs to communicate with one of the nodejs application listening at port 4000 in my Google cloud Virtual machine through internet.
GCP provided internal and external IP. When I run the internalIP:4000 in browser of VM, I can see it is running fine. But outside of the VM, when I run ExternalIP:4000 it is giving error. I don't know why it is not working.
This is the firewall configurations
So you already established that your service is running fine and is on a correct port (4000).
Now you have to expose to the Internet. By default this port is blocked for any traffic by GCP's Firewall. This way only ports for SSH, RDP or ICMP protocols are open to be able to connect to your VM's. If you need non-standard port you have to create apropriate firewall rule.
You can create it by running using Cloud Shell or running this in your VM's command prompt:
gcloud compute --project=my-project-name firewall-rules create my-app-port \
--direction=INGRESS --priority=1000 --network=default \
--action=ALLOW --rules=tcp:4000 --source-ranges=0.0.0.0/0 \
--target-tags=my-app-server
or create it using Cloud Console. Have a look at the documentation if you have any doubts.
In my example I used my-app-server network tag. You need to add it to your VM that runs the app server - otherwise the rule won't work. It's best to do it this way since you're only exposing one additional port on a single VM which is safest possible solution.

How to allow metabase work with instance IP on Linux

I am relatively new to AWS and metabase. I am trying to setup metabase with AWS EC2 instance. I have been able to spin up the instance and ssh into the server from my local linux machine. I also tried http://localhost:3000/ and was able to access metabase homepage but now I want to use the EC2 instance public IP in this format: http://ec2ip:3000/ but it is not going through.
I have followed the following steps:
make sure the port 3000 is not blocked by the firewall
Ensured port is open in the inbound rules
Added port 3000 to my ufw locally.
But still I cannot access metabase home page from http://ec2ip:3000/. Please advise on how I can salvage the situation.
Thank you.

Cannot connect to my website running on Azure VM

I cannot seem to connect to my website running on Azure VM. I have looked through every single Azure docs.
I allowed incoming connections to port 80 per documentation:
I have a very basic Hello World nodejs app listening on port 80 (i confirmed this app works locally my own system):
I am attempting to connect to the site via the Public IP assigned to me that i see in Azure Portal:
The problem is any attempt to connect to 40.XXX.XXX.230:80 in Chrome simply times out.
I am new to VM's but i think something is wrong with port forwarding?
Another thing to check:
Remote desktop into the virtual machine, and confirm that the virtual machine's local firewall allows incoming HTTP and HTTPS connections.

Cannot access EC2 on specific port, even though I added security group

I created a web application and mounted it on an EC2 Windows instance.
Since it is created with Node.js Express and I didn't touch anything about localhost or port stuffs,
it is being listened on the port 3000 on npm start.
After I did npm start on the EC2 instance, then I can access it by "localhost:3000" within the EC2.
But when I try to access it from outside the EC2 with its public IP, like ip_address:3000, it keeps returning connection timed out error.
As I wrote in the title, I added a custom TCP security group that makes the instance opened for any IP addresses and with port 3000 but it still doesn't work.
What can I do? What am I possibly missing?
Thanks in advance.
Couple of things could be going wrong here.
Firstly - confirm your web application is actually running from within the instance.To do this on any recent windows in powershell: Invoke-WebRequest http://localhost:3000.
Secondly - confirm the security group on the instance allows incoming traffic for your designated port - HTTP(80) or HTTPS(443).
Thirdly - since you mentioned your instance has a Public IPv4 address, it must be located within a VPC and a Subnet. Navigate to the VPC service within the AWS Console and have a look at the Network ACL for that subnet. It's possibly denying all incoming traffic - rendering your security group settings unused.
If you're unsure on whether the subnet is blocking incoming traffic or not, have a look at these docs.

Hosting web application on Amazon AWS EC2

I am developing a web application locally. However, I would like to host the final product on an Amazon EC2 instance. I have moved my web application to the EC2 instance and am able to run the application; it's now listening on port 8081.
What I don't understand is how to allow users on the internet to access the web application running on port 8081 of the EC2 instance. I have tried redirecting the domain name to the IP address of the EC2 instance on the NameCheap DNS (where we bought the domain) to no avail. I suspect one of the things I need to do is set the permissions of the EC2 permission group but what should I set it to?
Help is greatly appreciated!
Thanks!
You can setup a nginx server to proxy all request to the port 8081.
Read more information here: https://doesnotscale.com/deploying-node-js-with-pm2-and-nginx/
Generally speaking, for a public web application you will want to run on a standard port (e.g. 80 or 443). You could do that by just running your node app as a privileged user (required by most OS's to expose 80 or 443), but generally it's better to have a web server in front pass the traffic, treating your node app as an upstream server (even if it's on localhost). NGinX is a good choice for this.
Regardless of what port you want to run it on, you'll need to update your EC2 security policy for that instance to allow traffic on that port (80, 443, 8081, whatever). You'll also need to make sure it's exposing a public IP address. It's not a bad idea to assign it an Elastic IP, since you'll wnat it to have the same address across instance reboots.
Finally, depending on what AMI you're running from, there may be a host firewall configured that you'll need to check on and configure to allow the traffic.

Resources