I set environment properties for my Elastic Beanstalk environment, but when I log in to an EC2 instance in my Elastic Beanstalk environment and list shell environment variables, I don’t see these properties.

With the exception of stacks running PHP, environment properties are not automatically exported to the shell, even though are present in the instance. Instead, they are made available to the application through the stack it runs in, based on which platform you’re using.

The following are example locations for environment properties for a few of the available platforms:

Python: Environment properties are written to /opt/python/current/env, which is sourced into the virtualenv stack where the application runs. To set the source, log in to the instance and run the following command:

~$ source /opt/python/current/env

Ruby: Environment properties are first written to a JSON file tha contains all of the stack configuration information, found at /opt/elasticbeanstalk/deploy/configuration/containerconfiguration. When the predeployment hook at /opt/elasticbeanstalk/hooks/configdeploy/pre/10_setup_envvars.sh is triggered, /opt/elasticbeanstalk/support/envvars is populated. This file, which contains all of the environment properties, is then sourced by the stack to make the environment variables available to the application. To set the source, log in to the instance and run the following command:

source /opt/elasticbeanstalk/support/envvars

Java: Environment properties you set at launch do not become shell environment variables, though they behave in a similar way. For more detailed information, see Configuring Your AWS Elastic Beanstalk Java Environment.

To view and set environment properties, use the eb_setenv AWS CLI command.

Elastic Beanstalk, Ruby, Python, Java, environment properties


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2016-12-12