Accessing Elastic Beanstalk Envionment Variables on the Command Line
Overview
Sometimes it is useful to have access to key/value pairs created in the EBS environment configuration, for example to insert them into commands that create security certificates.
Location
The location on the file system where EBS stores environment variables registered through the configuration of the EBS environment: /opt/elasticbeanstalk/deployment/env
Loading EBS key/value pairs
to access EBS environment variables on the command line:
$ source /opt/elasticbeanstalk/deployment/env
Actually, ec2-user doesn’t have permission to do that to that file. .ebextension config files seem to run as super user, so it should be fine within that context.
To get this functionality from the command line on a EBS server:
$ source <(sudo cat /etc/environment)