Setting environment variables in cloudformation using command module within cfn-init
<p>I'm trying to set environment variables through the commands module within cfn-init.</p>

<pre><code>"commands": {
              "set-env": {
                "env": {
                  "HOSTNAME": "fb-iaas.elevatebilling.com"
                },
                "cwd": "~",
                "command": "echo \"$HOSTNAME\" &gt; test.txt"
              }
            },
</code></pre>

<p>And this is the output I see in cfn-init.log</p>

<pre><code>2016-09-22 10:26:53,638 DEBUG Running command set-env
2016-09-22 10:26:53,639 DEBUG No test for command set-env
2016-09-22 10:26:53,655 INFO Command set-env succeeded
2016-09-22 10:26:53,655 DEBUG Command set-env output: 
</code></pre>

<p>But environment variable HOSTNAME doesn't get updated. Can someone please explain what am I doing wrong?</p>

<p>Thanks</p>