Spring Boot Application deployed on Elastic Beanstalk Java environment returns 502 Spring Boot Application deployed on Elastic Beanstalk Java environment returns 502 nginx nginx

Spring Boot Application deployed on Elastic Beanstalk Java environment returns 502


Nginx doesn't know on which port your spring boot applicaiton is running.Make application run on port 5000 that Nginx redirects to by default by adding "server.port=5000" to application.properties or other suggested ways in the last step:

https://pragmaticintegrator.wordpress.com/2016/07/12/run-your-spring-boot-application-on-aws-using-elastic-beanstalk/


From your question description and the security group settings you send me your only inbound Port 80 for your EC2 instance was open to world through firewall and you were using port 5000 for your application. So using the security rule that I gave you it opened the inbound port 5000 too for your EC2 instance so your application started working without above error.


If somebody is still getting such error, after setting server.port=5000.Here's what you can do if you got db connectivity:

  1. In configuration section of your dashboard, go to RDS section and create a remote db. Remember username, password of formed db.

  2. In Software section, add following properties:

SPRING_DATASOURCE_URL=jdbc:mysql://(your-db-url)/ebdb

SPRING_DATASOURCE_USERNAME=(username)

SPRING_DATASOURCE_PASSWORD=(password)

SPRING_JPA_HIBERNATE_DDL_AUTO=update

SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.MySQL5Dialect