Deploying Spring Boot on AWS - Options

This year I have been doing hands on with Spring boot, AWS, and microservices architecture.  Spring boot is the best tool or framework for implementing the microservices.  There are multiple ways to deploy the Spring boot application in AWS:
  1. Spring boot on EC2
  2. Spring boot on Elastic BeanStalk
  3. Spring boot as Docker on ECS
  4. Spring boot as Lambda
And it really depends on context.

Deploying Spring boot on EC2 instance is the first thing one will try and this post has details of how to do it.  If the Spring boot application is a mini monolith with all REST API's (signup, signin, users, and so on) packaged in one jar or war file with all the java code then application can be deployed on one EC2 instance and run but requirement will arise for more instances and load balancer in front.  Therefore, we will have to manage multiple EC2 instances, load balancer, databases, and so on.  In that case in order time and cost (well it depends) Elastic BeanStalk is the best and easiest option. Read this post for introduction to deploying the Spring boot on Elastic BeanStalk.  A post on medium is an example of how Elastic BeanStalk is better than few alternatives.  If the application is packaged as war then I found it is easy to view application logs.
Dockers have a learning curve and it make sense when it is a true microservice architecture.  The architectre has several spring-boot appliations and each one needs to scale independently.  Read here.  This shoud be most popular use - Spring boot + Dockers + ECS
Last option is to deploy th spring boot as Lambda.  Well this is least probable use case but might arise, it is good to know that this is also possible. 

Comments