Today is Thursday, 7th March 2019

Archive for March, 2019

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 application.properties 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 application.properties, 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.