'ECS: I need create different services from the same Task but using different environment variables...is it possible?
My problem is the following:
I need to run a docker container for every user in a platform, all these containers use the same docker image, but you can pass some environment variables like user_id,queue_id,etc in order for them to know which user they belong to
I know that I can create tasks and pass environment variables to them, but for me seems not OK to have thousand of identical tasks using the same docker image but different variables...suppose I want to update the docker image or make some change... in this way I would have to iterate and change every single task
My idea was create a single task and then, run different services using this task and passing different environment variables, so I would have some "username_x_service_task1" for the username_x running the task1
but this doesn't seems possible, at least not using boto3, the only thing I can define in the service are tags
my questions is:
- this approach is correct?...or must I create different tasks for different users although the image is the same?
- would be possible, inside my running service, to access to its custom tags, so I'd use the tasks to pass user_id queue_id and other required information?
- is there any better way to do this :sweat_smile: ?
thank you guys.
Solution 1:[1]
Yes this is possible. You would define Container Overrides at the service level to override the environment variables set in the task definition, or to add additional environment variables.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mark B |
