How do you pass custom environment variable on Amazon Elastic Beanstalk (AWS EBS)?

Ben picture Ben · Jun 26, 2012 · Viewed 79.2k times · Source

The Amazon Elastic Beanstalk blurb says:

Elastic Beanstalk lets you "open the hood" and retain full control ... even pass environment variables through the Elastic Beanstalk console.

http://aws.amazon.com/elasticbeanstalk/

How to pass other environment variables besides the one in the Elastic Beanstalk configuration?

Answer

lime picture lime · Jul 26, 2013

As a heads up to anyone who uses the .ebextensions/*.config way: nowadays you can add, edit and remove environment variables in the Elastic Beanstalk web interface.

The variables are under Configuration → Software Configuration:

Environment Properties

Creating the vars in .ebextensions like in Onema's answer still works.

It can even be preferable, e.g. if you will deploy to another environment later and are afraid of forgetting to manually set them, or if you are ok with committing the values to source control. I use a mix of both.