I currently use the Elastic Beanstalk to run the docker image from ECR and my Dockerrun.aws.json looks like follows
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "12345678.dkr.ecr.eu-west-1.amazonaws.com/test-web:latest",
"Update": "true"
},
"Ports": [{
"ContainerPort": 80,
"HostPort": 80
}]
}
I generate this Dockerrun.aws.json file automatically in buildspec.json (for CodeBuild) and pass this file as an output artifact. Having the configuration values generated at every build seems wrong to me.
Now, I would like to also have some environment variables when running the container. The variables defined directly in Elastic Beanstalk would be perfect for me. But it is not being populated inside the container. From the internet, I see the only option is to have it in .config file. But I don't want to do this as it can expose the sensitive keys.
Is there any other solution in which I can pass the environment keys to the container? (For example, by using secret manager or other means of sharing EBS env variable to docker)