Search code examples
javaspringamazon-web-servicesamazon-elastic-beanstalk

Elastic Beanstalk fails creating


I finally reached the point where my Elastic Beanstalk Instance / Environment got launched. (Java Corretto 11 Platform) Now it fails starting up the provided .jar file.

In the eb-engine.log file, I am not able to find any more error than this:

2021/05/27 11:36:25.889735 [INFO] Executing instruction: StageJavaApplication
2021/05/27 11:36:25.889871 [ERROR] An error occurred during execution of command [app-deploy] - [StageJavaApplication]. Stop running the command. Error: staging java app failed due to invalid zip file 

The jar file is a Spring Boot application built with mvn -B package. Locally the whole thing starts, but crashes afterwards because of not given environment variables (Expected behaviour). But it seems AWS is not even starting the application..

Any suggestions on this?


Solution

  • Spring Boot apps run nicely on Elastic Beanstalk. However, you do need to set some variables. For example, have you set server-port variable to 5000?

    And as you stated, to successfully use a Service Client, you can set environment variables for your creds. Here is an end to end walkthrough that shows how to successfully put a Spring BOOT app that invokes several AWS Services on Elastic Beanstalk.

    Creating your first AWS Java web application

    PS - your log file mentions a ZIP file. Be sure to create the JAR properly as discussed in the above example.