Setting NODE_ENV variable in elasticbeanstalk
Other ways to set environment variables
in elastic beanstalk are -
Create a config file in
.ebextensions
directory likeenvironmentalvar.config
and define variables inoption_settings
and include this file into application bundle. (Aws Documentation)example -
option_settings: aws:elasticbeanstalk:application:environment: NODE_ENV: production
By using elastic beanstalk command line tool. Command for set variable-
eb setenv VAR_NAME=VAR_VALUE
Your .config file should be located in the .ebextensions
directory, not .elasticbeanstalk
.
Try it then, if that doesn't work, you can always use the console.
In the meantime, you can always use the Elastic Beanstalk Console which let's you add environment variables from its interface. To do so, just:
- Open up your environment.
- You'll see Dashboard, Configuration, Logs and more on the left. Click the Configuration link.
- Then click the gear icon next to the Software Configuration block.
- Scroll down and add a key/value for the Environment Properties.