In Elastic Beanstalk, is it possible to reference an Environment Property from an .ebextensions *.config file?
For example, using Cloud Formation I've added the following Environment Property to the environment that is created -
- Namespace: "aws:elasticbeanstalk:application:environment"
OptionName: "LOAD_USER_PROFILE"
Value: !Ref "LoadUserProfile"
This property is added and displays as expected under the Environment Properties section of the Software Configuraion for my environment -
However, when I try to access the property via an .ebextensions *.config file, it fails with the following error -
Error occurred during build: Command loaduserprofile failed
Here is the command from my *.config file (derived from the answer given here), which works if I hardcode true
or false
in place of {$LOAD_USER_PROFILE}
-.
container_commands:
loaduserprofile:
command: appcmd set apppool "DefaultAppPool" -processModel.loadUserProfile:"{$LOAD_USER_PROFILE}"
cwd: C:\\Windows\\System32\\inetsrv
Is what I am trying to acheive possible, and if so, what am I doing wrong?
The statement that they are passed into the application as environment variables can be misleading.
They are actually passed as properties to your application, so it depends on what application you are deploying in EB. It appears you are using IIS/.Net so the property name and values are added to the web.config as per the answer below:
How to read Elastic Beanstalk Environment Properties in .net?