Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EnvironmentVariables default value length is greater than 4096

I am trying to deploy a rails app to Amazon Elastic Beanstalk(eb) environment

I got this error back:

Uploading: [##################################################] 100% Done...
2019-01-24 09:42:16    INFO    Environment update is starting.      
2019-01-24 09:42:26    ERROR   Service:AmazonCloudFormation, Message:Template format error: Parameter 'EnvironmentVariables' default value '[****]' length is greater than 4096.
2019-01-24 09:42:26    ERROR   Failed to deploy application.

I found this

The combined size of all environment properties cannot exceed 4,096 bytes when stored as strings with the format key=value.

in the amazon docs here.

My environment properties key value combined is much bigger than 4096 chars.

as most of the values are credentials for API and Payments, thus I end up with just a dozen of keys.

My app work just fine in Heroku, there is no such limitation on the env variables. I am wondering what is the reason behind this restrictions in eb.

Is there anyone experience with this?

In my case, I would like to increase the limit (4096). I don't wanna change my code just to fit the eb restrictions.

I am also open for any kind of workaround to overcome this 4096 chars.

Many thanks in advance!

like image 405
channa ly Avatar asked Jan 24 '19 10:01

channa ly


1 Answers

Beanstalk uses Cloudformation underneath to provision environments. As a result, there is a limit on environment variables. You can not increase this limit because it is hard-coded in the kernel to PAGE_SIZE.

This is a nice resource that explains an alternative approach for solving this problem.

like image 56
Tony Vincent Avatar answered Oct 22 '22 05:10

Tony Vincent