I set environment properties for my AWS Elastic Beanstalk environment, but when I log in to an Amazon Elastic Compute Cloud (Amazon 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 aren't automatically exported to the shell, even though they are present in the instance. Instead, they are made available to the application through the stack that 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 the file /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 then run the following command:

~$ source /opt/python/current/env

Ruby: Environment properties are first written to a JSON file that contains all the stack configuration information, which is found at /opt/elasticbeanstalk/deploy/configuration/containerconfiguration. When the predeployment hook at /opt/elasticbeanstalk/hooks/configdeploy/pre/10_setup_envvars.sh is triggered, the file /opt/elasticbeanstalk/support/envvars is populated. This file, which contains all 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 then run the following command:

source /opt/elasticbeanstalk/support/envvars

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

Windows: Environment properties are passed from this path to the IIS server.

C:\Program Files\Amazon\ElasticBeanstalk\config\containerconfiguration

To view and set environment properties, use the eb setenv EB CLI command. 

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

Updated: 2018-07-19