2/2 checks passed but Spring Boot app with SQL database deployed on EC2 Ubuntu fails to load and connection times out

0

I deployed a full stack Spring Boot application on an Ubunut server with AWS EC2, but even though the site would initially load, I have found that the connection is not consistent and more often than not, I cannot connect to the site and the connection times out. The strange thing is that the server is passing the checks. I am not sure what to do to diagnose/resolve the connection issue. Is there a better place to deploy Spring Boot applications?

Lucie
asked 2 years ago275 views
1 Answer
0

Are you getting issues under heavy load or even with simple functionality testing? If it is the latter, you should look at the Springboot application logs to see if the Springboot application is getting the requests and running into issues or not.

If you are getting issues under load, you will need to vertically scale your EC2 instance or better, run an auto-scaling group of EC2 machines with an Application Load Balancer in front, so your EC2 machines can scale with load. You could set that up yourself, or else use Elastic Beanstalk that does lot of the heavylifting for you as illustrated in this blog - https://aws.amazon.com/blogs/devops/deploying-a-spring-boot-application-on-aws-using-aws-elastic-beanstalk/. Note that this blog is old so some screens may have changed.

You have other options as well on AWS. You could run your Springboot application as a containerized application and use ECS or EKS to orchestrate. You can get guidance from the following documents - https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/deploy-java-microservices-on-amazon-ecs-using-amazon-ecr-and-aws-fargate.html, https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/deploy-java-microservices-on-amazon-ecs-using-amazon-ecr-and-load-balancing.html and https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/deploy-a-sample-java-microservice-on-amazon-eks-by-using-amazon-ecr-and-eksctl.html

The third option is to deploy your Springboot application on AWS Lambda. You can refer to AWS samples that show you how to run Java applications built using frameworks like Springboot, Micronaut and Quarkus using GraalVM to reduce cold starts - https://github.com/aws-samples/serverless-java-frameworks-samples

profile pictureAWS
EXPERT
answered 2 years ago
profile pictureAWS
EXPERT
reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions