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

rhyhro

Illia Hryhoryshyn

Posted on May 13, 2021

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

💖 💪 🙅 🚩
rhyhro
Illia Hryhoryshyn

Posted on May 13, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

What was your win this week?
weeklyretro What was your win this week?

November 29, 2024

Where GitOps Meets ClickOps
devops Where GitOps Meets ClickOps

November 29, 2024