In the ecs cluster, I have a service running with 2 ec2 instances. And i update the task definition to take the new docker image. But the old task definition is still running even though there is a new task definition.
I have used the following commands to update the task definition and service.
aws ecs register-task-definition --family service90-task --cli-input-json file://service90-task.json
aws ecs update-service --cluster service90-cluster --service service90-service --desired-count 0
TASK_REVISION=`aws ecs describe-task-definition --task-definition service90-task | egrep "revision" | tr "/" " " | awk '{print $2}' | sed 's/"$//'`
aws ecs update-service --cluster service90-cluster --service service90-service --task-definition service90-task:${TASK_REVISION} --desired-count 2
I tried several times but can't figure out where i went wrong. I want to get the ecs service to run the new task definition instead of the old one.