Elastic Beanstalk fails on environment variables update

Viewed 1420

I've deployed my Spring boot application to an ELB with Corretto 11 running on 64bit Amazon Linux 2/3.0.1 platform.

When I am trying to add a new Environment Variable from the AWS Console ( Configuration -> Software) and I hit Apply the update fails and rollbacks to the previous configuration.

This what I get from the AWS Console on my environment dashboard enter image description here

Here are some of the logs that might be useful enter image description here

The interesting part is when I create a fresh new environment and upload my .jar file and add the environment variables at the instantiation of my environment it works (meaning the environment variables are set correctly). The problem occurs when I try to update my environment variables when then environment already exists. Am I missing something?

I tried to use $ eb setenv after the $ eb deploy from my circleci but I still get the same error.

2 Answers

I've been digging into this. And now I know why it fails.

The reason is that when you add the env variable to your EB, the EB engine is going to download last application version, unzip and replaces it as current application.

This means, no deployment hooks nor .ebextenstions scripts are not executed. Therefore, if you do any application setup during deployment it is not going to be re-applied, leading to failure.

This is based on my own observations using Python 3.7 running on 64bit Amazon Linux 2/3.0.3 and single-instance EB type.

I found a workaround. If you set your deployment to immutable, this will go away as it’s gonna create a band new ec2 instance for you. Not the best solution if you have quota limitation but it works.

Related