简体   繁体   中英

How to run application on port 3000 on Public and Not Private IP Address in AWS EC2 Instance (so it can be accessed on the internet)

My problem is that I want to run an application on an AWS EC2 instance on port 3000. I then want to be able to access it from the inte.net using http:/PUBLIC_IP:3000. The problem is that when I am running the application on the EC2 instance, it runs on the private IP - and therefore I cant access it from the inte.net. How would I make sure that the app will run on the public ip, or how would I set it up, so I can access the application over the inte.net?

I tried to find a solution online, but some hours later I find myself in here.

To access your application from Inte.net, EC2 instance need to be attached with a Public IP. To attach the Public IP to your EC2 instance, kindly refer the doc

Based on your OS, you need to open port 3000.

For example, if it is an Ubuntu OS. You can run the below command to see the ufw is running or not.

sudo ufw status

If it is running, you can allow port 3000 by running the below command.

sudo ufw allow 3000

To check whether the port 3000 is listening or not. You can run the below command.

netstat -anp | grep 3000 

or

telnet 127.0.0.1 3000

After completing from the OS side, you can configure the security group to allow the port 3000 which is attached to the instance.

Thank you for your help. It was very helpful in debugging the error. It turned out that the security group of the EC2 instance was not allowing traffic on port 3000 so I had to add that - and then it worked.

I furthermore had trouble putting it behind a Load Balancer. The solution to that was that it was a webpack application and in.webpack there is a configuration file where you can add eg, allowedHosts: [.amazonaws.com].

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM