How to specify port for NodeJs application hosted in ElasticBeanStalk?
Asked Answered
B

1

5

How does port in ElasticBeanStalk works? I have a NodeJs/ExpressJS application which will be deployed in ElasticBeanStalk.

The ElasticBeanStalk has a load balancer used to attach SSL certificates. Should i specify the port from my nodejs application?Can it be any port? Or elastic beanstalk has some specific ports for this? Can someone throw some lights on this? I think the elastic bean stalk comes with a default infront of it. So is port specified in this?

Boggs answered 4/12, 2017 at 7:46 Comment(0)
C
8

You should use process.env.PORT to get the port from environment variables.
Elastic Beanstalk will set it for you.
Externally port 80 will be opened and will be routed to the port configured on Elastic Beanstalk.
Your Load Balancer with SSL will probably forward traffic from port 443 to Elastic Beanstalk.

See more in these docs.

Chip answered 4/12, 2017 at 8:30 Comment(4)
Can I use a different port if I want,?Boggs
You can configure it in the reverse proxy configurations. Why would you want to do that though?Chip
i am planning to start a multiple port application from node js. Two servers listening to different ports. Can you help with the configurations?Boggs
I will be happy to help with concrete questions. Are you going to run two servers on the same Elastic Beanstalk configuration? Is it the same node server listening on two different ports?Chip

© 2022 - 2024 — McMap. All rights reserved.