0

I am looking for advice/ideas on how to continuously deploy new features to a Spring Boot web application that is hosted on an AWS EC2 instance. My current workflow:

  1. bootRepackage my application to create a war file.
  2. Upload that file to AWS.
  3. Add a new feature to my application.
  4. bootRepackage again.
  5. Remove the current war from AWS, and upload the new one.

This is obviously not a good workflow, as the application needs to be restarted which could result in 1) downtime and 2) entries in the database being lost (if I'm using Spring's default H2 database - I am not, I'm using a standalone SQL server, but just making the point for this question) so I am wanting to streamline it.

Is there any way to add a new feature to the current instance of the service on AWS? Is it possible to recompile the code "one the fly" to prevent the need to restart the application?

Is there any way of creating a better setup that would allow me to just merge a new branch to master locally, and push that with the same instance still in prod except with this new feature?

Thank you in advance!

Update, is this really the correct answer?

1 Answers1

1

If you using single instance of aws and deploying the application to EC2 instance, please assign Elastic IP for the AWS EC2 instance.

An Elastic IP address is a static IPv4 address designed for dynamic cloud computing. An Elastic IP address is associated with your AWS account. With an Elastic IP address, you can mask the failure of an instance or software by rapidly remapping the address to another instance in your account.

  1. Deploy the new version of the application in another AWS EC2 instance
  2. When the application is ready, reassign the Elastic IP from the existing EC2 instance to new EC2 instance

Elastic IPs are the simplest way to implement the blue-green switch.

notionquest
  • 37,595
  • 6
  • 111
  • 105