I am trying to access an environment variable which i defined in the Elastic Beanstalk configuration. I need to access it within a config file in .ebextensions
or in a file that is shared below. I have tried the following:
packages:
yum:
awslogs: []
files:
"/etc/awslogs/config/beanstalklogs.conf":
mode: "000644"
user: root
group: root
content: |
[/var/log/httpd/error_log]
log_group_name=/aws/elasticbeanstalk/myapp-$APP_ENV/var/log/httpd/error_log
log_stream_name={instance_id}
file=/var/log/httpd/error_log*
[/var/log/httpd/access_log]
log_group_name=/aws/elasticbeanstalk/myapp-$APP_ENV/var/log/httpd/access_log
log_stream_name={instance_id}
file=/var/log/httpd/access_log*
# commands:
"01":
command: systemctl enable awslogsd.service
"02":
command: systemctl restart awslogsd
https://stackoverflow.com/questions/29423608/accessing-environment-variables-in-aws-beanstalk-ebextensions#:~:text=I%20reached%20out%20to%20the%20Amazon%20technical%20support%20for%20an%20answer%20to%20this%20question%2C%20and%20here%20is%20their%20reply%3A with this answer i change the commands to container_commands but its not working