Here is what worked for me. I tried the accepted approach and it did not produce the desired result (curly braces were included in the output). Troubleshooting commands that are executed from a .config file when uploading to Elastic Beanstalk is also a bit of a challenge (or I just don't know exactly where to look).
AWS Environment:
- Type - Elastic Beanstalk
- Platform - 64bit Amazon Linux 2015.09 v2.0.4 running PHP 5.6
Elastic Beanstalk Environment Properties (Configuration -> Software Configuration -> Environment Properties):
- Property Name - HELLO_VARIABLE
- Property Value - test
Sample .config File included in the .ebextensions folder in the deployment artifact:
container_commands:
0_test-variable:
cwd: /tmp
command: "touch ${HELLO_VARIABLE}_0_.txt"
1_test-variable:
cwd: /tmp
command: "touch {$HELLO_VARIABLE}_1_.txt"
2_test-variable:
cwd: /tmp
command: "touch $HELLO_VARIABLE_2_.txt"
After the artifact has been deployed using Elastic Beanstalk the /tmp directory within an EC2 instance will contain the following files (note curly braces and position of $):
- touch ${HELLO_VARIABLE}_0_.txt creates /tmp/test_0_.txt
- touch {$HELLO_VARIABLE}_1_.txt creates /tmp/{test}_1_.txt
- touch $HELLO_VARIABLE_2_.txt creates /tmp/.txt