How to deploy Spring boot war file to Amazon Lightsail

4k views Asked by At

I am building a simple Spring Boot application that I want to deploy on a server.

I've set up a Amazon LightSail Linux and installed tomcat8 and mysql-server.

I already know how to get a war file from my project. The question is how to upload it to the server?

I know there are Amazon tools for deploying code to EC2 instances but I have an Lightsail instance so I can't find value key pairs to couple my server with AWS codedeploy.

Can this be done by using SSH or FTP?

Lightsail is supposed to offer a simple management console but I can't seem to find how to deploy an application to it.

3

There are 3 answers

0
Sytham On BEST ANSWER

I found out about tomcat manager gui, first I needed to install tomcat8-admin-webapps and tomcat8-docs-webapps, then I can access the Tomcat Web Application Manager where I can upload a War file.

0
Samuelitor On

If I were you, I'd do a git clone from BB or your github or SCM host of choice and package up a war from the command line from your lightsail instance and just load it from there.

0
Murali Murugesan On

This is what I did,

  • Download and install FileZilla
  • Download the default key from Lightsail Note: - Looks like, this action uses AWS KMS in the background and charges might be incurred.
  • Connect using (SFTP) using the public IP (LightSail) and username(Ubuntu) - No password required.
  • Upload war or jar files to a directory under your LightSail instance.
  • Use LightSail web SSH and start the jar

I don't suggest cloning the repository to LightSail and build war from there, as it would use up more disk space for downloading maven dependencies.

Other option could be, to upload artifacts (war/jar) to S3 and download to LightSail.