I've seen this question asked on this site throughout the years, but none of the solutions have worked for me. I'm attempting to launch a spring boot application using AWS Elastic Beanstalk. I am getting the "502 Bad Gateway nginx/1.20.0" error that many others have gotten. Looking at my logs it says "connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.16.189, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/"".
In my code I have specified the app to use port 5000:
I've also specified it within the environment properties:
I'm at a loss as to why I'm still receiving this error, any help would be appreciated.
Thanks in advance.
There are other considerations when deploying an AWS Spring BOOT app. Are you using an AWS Service Client in your app. If so, how are you setting the creds? How did you package your app? Did you package all the dependencies.
Follow this small example and see if you can get this app deployed.
Creating your first AWS Java web application
This app is successfully deployed: