6
votes

Normally, I build a Java web app using Tomcat or Glassfish into a WAR (web app archive file). This file can easily be deployed into AWS through Elastic Beanstalk with a few clicks. The integration is simple because Elastic Beanstalk allows us to deploy a web app on Tomcat/Glassfish/Java.

I recently started using a lightweight java framework called Spark, www.sparkjava.com . Is it possible to deploy this on Elastic Beanstalk in a few clicks? If not, is there an alternative to easily deploy a Spark Java web app onto AWS? Or, would I need to create an EC2 instance, copy the JAR app, and launch the JAR web app via command line?

2

2 Answers

6
votes

Sure you can, either by deploying it as a war via the Tomcat platform, or run it as a fat jar via the Java SE platform.

0
votes

I published an Archetype for AWS Elastic Beanstalk that uses DropWizard instead of Spark (but both use Jetty) - It should be pretty straightforward to adapt it to Spark. Note it uses the Docker Solution Stack (more flexible and easier to debug locally). This command should get you started:

$ mvn archetype:generate -Dfilter=elasticbeanstalk-docker

Also, AWS allows you to create a custom Java Application, like @k.liakos said in his answer.