I have built a nodejs application which subscribes to Mosquitto MQTT Broker topic, and saves the incoming data to DB. I have also dockerized the app.
I need the app to run in a container, with its own environmental variables. i.e The different instance of an app write data to different destination. Ex. instance1 app will have env variable DEST=jdbc:postgresql://localhost:5432/postgres and instance2 app will have env variable DEST=jdbc:postgresql://localhost:5431/postgres.
I am not clear how to achieve this requirement with AWS ECS, not sure how port mapping will work. Whether I should create different task definition for each app instance, so that I have freedom to specify env variables there or create one task definition and create multiple services out of it.
I am not clear how to achieve this requirement with AWS ECS, not sure how port mapping will work. Whether I should create different task definition for each app instance, so that I have freedom to specify env variables there or create one task definition and create multiple services out of it.
You can't specify environment variables at the service level. You would need to create separate task definitions.