Application source bundle doesn’t work when uploaded to AWS Elastic Beanstalk

Tags: , , , ,



I’m trying to upload a Java/Spring Boot app that runs in a Linux 2 Coretto 11 environment. Everything worked fine when I uploaded the standalone JAR files, but I started creating an application bundle instead so I could configure the environment, specifically client_max_body_size.

It looks like the app is starting but then some error happens with not much info (logs). In the EB console, I keep getting the error: During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version.

I uploaded the bundle as a .zip file- It contains the JAR, a Procfile, and an .ebextensions directory containing a config file (~/.ebextensions/01_files.config), all three of which are in the root directory of the zip file. The latter two are shown below:

Procfile: web: java -Dfile.encoding=UTF-8 -Xms2g -Xmx2g -jar DocumentSummarizer-1.0-SNAPSHOT.jar

config file: 01_files.config

The config file has proper indentation for YAML (2 spaces).

I feel like I’ve tried every variation from StackOverflow and Amazon’s documentation to accomplish this goal, so I’m just beating my head against the wall at this point. Any help would be greatly appreciated.

Update:

u/Marcin’s answer was correct (nginx settings needed to be in .platform/nginx/conf.d/mynginx.conf). The second issue that I dealt with for a while after that was not having a semicolon after the value. I thought it was only necessary if you have multiple values, but it won’t work properly unless there’s one after each value (i.e. client_max_body_size 20MB;).

Answer

A likely reason is that you are using EB env based on Amazon Linux 2 (AL2). If this is the case, then your the 01_files.config is incorrect.

For AL2, the nginx settings should be provided in .platform/nginx/conf.d/, not .ebextentions. Therefore, for example, you could create the following config file:

.platform/nginx/conf.d/mynginx.conf

with the content of:

client_max_body_size 20M

Please note, that there could be many other issues, which are not apparent yet, especially if you followed any instructions for AL1. The reason is that there are many differences between AL1 and AL2.



Source: stackoverflow