Search code examples
amazon-web-servicesspring-bootmicroservicespackaging

Spring boot Microservice Cloud Deployment Packaging Format


I am trying to develop a microservice using spring MVC and spring boot with spring cloud. Here I am practicing my java microservices using JAR packaging. When I am using Maven build tool , also uses JAR file when building project. My ultimate aim is to deploy my microservice into AWS cloud.

  • Here My confusion is that , when I am approaching for cloud deployment, Is necessary to build my microservices using WAR format? Or JAR ?
  • Which format I can utilize for my deployment of services into cloud? In local I am now only using JAR format. Can I follow the JAR format in cloud deployment? Which is better option for my service?

Can anyone give clarification for the packaging format of my microservices in cloud,since I am a beginner to cloud platform.


Solution

  • Since you are using the spring boot, it supports UBER JAR format, which is the most recommended way for microservices these days since it has the embedded support for server tomcat / jetty / etc. Check 12-factor apps

    Once you have the jar simply pushing it in the EC2 and running the java -jar command would start running the server. And in spring boot application.properties you can define the server listen port and the same can be allowed from security groups.

    Further you can have Ec2 attached to the ELB.