5

I have difficulty trying to set up over 100 environment variables in my production Elastic Beanstalk running Django. The AWS docs mention that

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

To my understanding there are 3 ways to set env vars in ELB.

  1. Through eb cli e.g eb setenv key=value(Doesn't work because it'll error out because of maximum length after reaching the maximum no. of characters)

  2. Through the EB GUI Configuration > Software > Env variables (Doesn't work for the same reason above)

  3. Through

    option_settings:

    • option_name: CUSTOM_ENV value: staging

I imagine 3) would fail for the same reason too.

I'm now experimenting with downloading my variables.env file from my S3 bucket and then replacing /opt/python/current/env with it

files:
  # Private key
  "/opt/python/current":
    mode: "000400"
    owner: root
    group: root
    authentication: "S3Auth"
    source: ****/env

the idea being that ELB injects environment variables through that file. Unfortunately, the deployment errors out (permission error).

Is there a way to circumvent the 4096 bytes limitation on ELB environment variables?

djvg
  • 11,722
  • 5
  • 72
  • 103
sgeza
  • 341
  • 1
  • 5
  • 16

1 Answers1

0

There seems to be no way to increase it within EBS as its a hard-coded limit (EnvironmentVariables default value length is greater than 4096). They also link to a workaround there.

Otherwise you could try to reduce the amount of characters used, e.g. TRUE -> 1, as described in this article https://insights.project-a.com/aws-elastic-beanstalk-when-not-to-use-it-b04dc95b2e9c. But of course this is not scalable and you might run into the same problem again.

emjeexyz
  • 376
  • 3
  • 6