I am trying to set an environment variable in the EC2 instance hosting ECS containers. The environment variable should be readable by the docker client on the EC2 instance at run time. I know it's possible to add userData like so:
#!/bin/sh
echo export env_var=1 >> /etc/environment
But for some reason this env_var is not being picked up by the docker client when instantiating ECS tasks.
Any idea how I might go about doing this? Thanks in advance.