Search code examples
javaamazon-web-servicesspring-bootamazon-elastic-beanstalk

I can't deploy my Spring Boot application on AWS Elastic Beanstalk


I have an application developed in Spring Boot. I would like to deploy it on the AWS Elastic Beanstalk service. I've already followed some tutorials, I did as requested, but I can't get my application to work, and I believe it's because of the health status marked as "severe". I have no idea why the status is severe... as it's my first time using the service, I'm having doubts, I've tried looking for a solution on the internet and I haven't found anything that could help.

I followed the instructions in this tutorial.

In the example image of the tutorial, it is possible to see the health status as OK, however, after following the steps, the health status that is presented to me is severe or warning

My screen:

enter image description here

By the way, checking the option in question, when creating a new environment, I get an environment with the status OK and working, which makes me think that the error is in my jar file? That's what it looks like... but why this error? what is the reason?

Example image that results in ok status

enter image description here

Ah, when I enter the URL, the error 502 bad gateway appears.

To get the jar, I ran the mvn package command. Could this command be the cause of the problem? Or does it have something to do with API? The only endpoint I have is /api/user.

I have never used this service, I have no idea how to solve this problem.


Solution

  • It must've created ec2 with the load balancer go to your load balancer open the target group edit it and it has a health check path put in there a valid URI if you don't have it you can add for example /API/isHealthy get mapping which returns string saying "ap is up and running " for example,in your project's controller then recreate jar upload it in elastic beanstalk and update target groups health check URL to /API/isHealthy .Try this if it works fine but FYI you can handle the path with spring actuator .