ECS is nice, but has plenty of drawbacks (i’m using it since few weeks, and compared to kubernetes it’s a pain in that place..). Deploying a new release is one of the problem, you have to go to the website, add a new task, update the service and so on so forth.
Since I’m lazy and I hate wasting time for automated task, I created a script.
$(aws ecr get-login --no-include-email --region your_region ) docker build -t your_pacakge . docker tag your_pacakge your_ecs_repository_url/your_package docker push your_ecs_repository_url taskDef=$(aws ecs register-task-definition --cli-input-json file://ecs/task.json | jq -r '.taskDefinition.taskDefinitionArn') aws ecs update-service --cluster --service --task-definition $taskDef
- the ecs/task.json is the json you get in the JSON tab when you create the task, copy that one and remove all the fields that have as value null.
- it requires jq or you have to find a way to parse the output
- the docker commands URL and TAGS are in the repository page of ecs, you can copy from them.
Similar approach works also with fabric , except the login part (fabric wraps shells, so command are executed one and not saved), thus execute the login in the console before running the fab command.