I have simple CRUD spring boot app that I want to deploy to AWS via Beanstalk.
If I follow default steps and only choose custom VPC - app doesnt work.
If I doing the same and set SERVER_PORT: 5000 in env variables - app is working and I can use my API.
I have 2 questions:
I solved the issue by adding env variable, but I want to know why I have to do it.
By default Spring Boot listens on port 8080
. However, by default the Elastic Beanstalk environment runs a reverse proxy server on port 80
and forwards traffic to your application on port 5000
. Thus, to have the traffic proxied correctly to your application, you either have to modify the reverse proxy to forward to port 8080
, or just set the SERVER_PORT
environment variable (that Spring Boot automatically detects, and uses to configure what port it listens on) to port 5000
.
More details are documented here.