Search code examples
javaamazon-web-servicesjava-8amazon-elastic-beanstalk

Read variables of Amazon Elastic Beanstalk environment from the Procfile


The problem is about the configuration params that the application needs to be executed in the JVM. I defined the XMX and XMS environment variables but when deployed procfile can't read these variables.

Procfile:

web: java $XMS $XMX -jar application.jar

If I connect by ssh to the instance, I can't see my variables $ XMX and $ XMS.

What am I doing wrong? Or is there a better way to do it?


Solution

  • The solution is to execute a script in the procfile, in that script it reads the environment variables, I still think something is doing wrong, but it works

    Procfile:

    web: ./run.sh

    Script run.sh

    exec java $JAVA_OPTS -jar app.jar

    JAVA_OPTS: environment variable defined in instance

    Good Luck!