How to Deploy Spring Boot and AWS Elastic Beanstalk

Overview of Steps

  • AWS EBS expects for your apps to listen on port 5000
  • Update your Spring Boot to use: server.port=5000
  • Select Web App > Platform Java
  • Upload the JAR file

Create basic Spring Boot app

  1. Start with a simple REST Spring Boot app.
  2. In, change port to 5000: server.port=5000
  3. Open terminal window
  4. cd project directory
  5. mvn clean package
  6. java -jar target/myapp.jar
  7. Test it locally: http://localhost:5000

Deploy on AWS

  1. Log into to AWS
  2. Navigate to Elastic Beanstalk
  3. Create a new application
  4. Select app type: Web Application
  5. Give it the name: simple-boot-demo
  6. Create a new environment
  7. For platform, select: Java
  8. Select option to Upload your JAR file.
    Note: the screen says only WAR and ZIP files, but it does in fact accept JAR files
  9. Upload your JAR file:  target/myapp.jar
  10. Create the application
  11. Once app is created, then visit the app URL.
  12. You will see your Spring Boot app up and running.

Did you like my blog post?

Signup now and receive an email when I publish new luv2code content.

I agree to have my personal information transfered to AWeber ( more information )

I will never give away, trade or sell your email address. You can unsubscribe at any time.

Leave a Reply