I have an EB env with Docker web app (rails) properly deployed. I set several EB env variables and they are properly visible in the container. Now - I\'d like these EB env varia
I ran into the same issue, but needed the environment variables to be available during the execution of a post-deployment Bash script.
Since the jq parser is available on the (current) Amazon Linux AMIs, I was able to acheive something similar using it to parse the JSON and then export the environment variables on the host (this is an excerpt from an ebextensions config file):
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/export_env_vars_on_host.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
echo Defaults:root \!requiretty >> /etc/sudoers
for envvar in `jq '.optionsettings | {"aws:elasticbeanstalk:application:environment"}[] | .[]' /opt/elasticbeanstalk/deploy/configuration/containerconfiguration`
do
temp="${envvar#\"}";
temp="${temp/=/=\"}";
export temp;
done