How can I get environment properties to show up in my Elastic Beanstalk environment when I log in to an Amazon EC2 instance for Amazon Linux?

2 minute read

I set environment properties for my AWS Elastic Beanstalk environment. I don't see these properties when I log in to an Amazon Elastic Compute Cloud (Amazon EC2) instance in my Elastic Beanstalk environment and list the environment variables in the shell.

Short description

Even though they are present in an instance, environment properties aren't automatically exported to the shell, except for in stacks that run PHP. Instead, environment properties are made available to the application through the stack that it runs in, based on the platform that you use.

To view and set environment properties, use the Elastic Beanstalk console or the eb setenv command in the Elastic Beanstalk Command Line Interface (EB CLI).

The following resolution shows how to set the source for environment properties in several platforms. For information on additional platform-specific options, see Environment properties and other software settings. For information on how to access environment properties outside your code, see Platform script tools.


Important: The following resolutions apply only to Amazon Linux Amazon Machine Images (AMIs). For Amazon Linux 2 instances, see How do I use environment variables from an Elastic Beanstalk instance shell?

PHP, Python, Ruby, Node.js, and Java

For environment variable paths that are inside the instance, run the following command:

$ cat /opt/elasticbeanstalk/deployment/env

To verify the environment variables, run the following command:

$ /opt/elasticbeanstalk/bin/get-config environment


For Windows platforms, run the following command:

C:\Program Files\Amazon\ElasticBeanstalk\config\containerconfiguration
AWS OFFICIALUpdated 5 months ago

in the last AMI PHP 8.1 running on 64bit Amazon Linux 2/3.5.8 the file /opt/elasticbeanstalk/support/envvars doesn't exists

probably the documentation is outdated

profile picture
replied a year ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

profile pictureAWS
replied a year ago