Patrick Kafka
Patrick Kafka

Reputation: 9892

AWS Load Balancing a Node.js App on port 3000

I've got a Node.js Express web app that is using the default port 3000 and responds fine on an Ubuntu EC2 instance by elastic ip. I'm trying to setup Load Balancing built into AWS and can't seem to get a good health check to pass

Setup 2 ubuntu servers that server the app fine on port 3000.

Set the load balancer listeners for port 80 to route to Instance port 3000 and also tried routing 3000 to 3000.

Added the amazon-elb/amazon-elb-sg security group to my instance security groups just in case.

Set the health check to port 80 and 3000 to many valid urls within the project.

Anything I'm missing here?

UPDATE:

Turns out it was the simplest thing I was overlooking. Somehow my actual instances were in a security group with only 80 opened and I just had to add a rule to open 3000. Can't believe I missed that.

Upvotes: 10

Views: 14799

Answers (1)

Mike Brant
Mike Brant

Reputation: 71384

If you have the load balancer set up only to forward incoming requests on port 80 to port 3000 on the backend instances, then you shouldn't get any response when trying ports other than 80. If you are making the requests against port 3000 (i.e. http://yourdomain.com:3000/uri) you need to have your load balancer also forward incoming requests on port 3000 to port 3000 on the instances.

If you are using only port 3000 on the instances, then you need to make sure your health check points to port 3000. (i.e. TCP ping 3000, or HTTP to port 3000 against your /ping service).

Upvotes: 5

Related Questions