How to access an Elastic Beanstalk environment property from an .ebextensions config file

0 votes

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 -

enter image description here

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?

Sep 4, 2018 in AWS by bug_seeker
• 15,310 points
831 views

1 answer to this question.

0 votes

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?

answered Sep 4, 2018 by Priyaj
• 56,160 points

Related Questions In AWS

0 votes
1 answer

How to copy a folder from S3 to Elastic Beanstalk instance on its creation?

I had encountered similar problem. But i ...READ MORE

answered Aug 24, 2018 in AWS by Archana
• 4,090 points
446 views
+1 vote
1 answer

How to make an application private on AWS Elastic Beanstalk?

Like you said by default, your application ...READ MORE

answered Oct 25, 2018 in AWS by Archana
• 5,480 points
27 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer