Accessing Elastic Beanstalk Envionment Variables on the Command Line

From Littledamien Wiki
Revision as of 04:28, 13 June 2020 by Video8 (talk | contribs) (Created page with "== 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 sec...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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)