DEV Community 👩‍💻👨‍💻

Illia Hryhoryshyn
Illia Hryhoryshyn

Posted on

How to change env variables inside of docker container in AWS ECS

For example we have cluster in AWS ECS with 3 services:
alt text
And we want to change evn variables in api-staging service.

To do it we should create a new revision of task definition with updated env variables and then tell the service to use new task definition.
alt text
So, to create a new revision of task definition we should go to list of all revisions, select the last one and create a new revision.
alt text

To change the container evn variables we should go to container definitions section and edit our container: alt text
Set new values to env variables and then update container and save new revision of Task Definition:
alt text

When we have a new revision we should update our api-staging service and set the latest revision. Also don't forget to set force new deployment checkbox alt text

Top comments (0)

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠