sean717
sean717

Reputation: 12653

Reference environment properties in ebextension script

On my Elastic Beanstalk instance (Windows) I have defined an environment property

enter image description here

How do I use the value of this property in my .ebextension script? Something like

container_commands:
  0100_execute:
    command: echo %My_Env%

Upvotes: 0

Views: 47

Answers (1)

Lawrence Gil
Lawrence Gil

Reputation: 415

I'm not sure if this is what you need, and I'm definitely not familiar with the windows command line, but at least with EB instances in Linux you can use something like the following:

packages:
  yum:
    jq: []
files:
  "/tmp/read-env.sh" :
    mode: "000755"
    content: |
      #!/usr/bin/env bash
      ENV_VAR_NAME=$(/opt/elasticbeanstalk/bin/get-config environment | jq -r'.ENV_VAR_NAME')
      echo $ENV_VAR_NAME

I know this isn't the exact solution for your environment, but I hope it helps or at least give you an idea. To parse JSON in Windows maybe this post will help.

Upvotes: 1

Related Questions