I want to automate the deployment of my application by having my ECS service launch with the latest Docker image. From what I\'ve read, the way to deploy a new image version is
Yes, that is the correct approach.
And no, with the current API, you can't register a new revision of an existing task definition without duplicating it.
If you didn't use the CLI to generate the original task definition (or don't want to reuse the original commands that generated it), you could try something like the following through the CLI:
OLD_TASK_DEF=$(aws ecs describe-task-definition --task-definition )
NEW_CONTAINER_DEFS=$(echo $OLD_TASK_DEF | jq '.taskDefinition.containerDefinitions' | jq '.[0].image=""')
aws ecs register-task-definition --family --container-definitions "'$(echo $NEW_CONTAINER_DEFS)'"
Not 100% secure as the last command's --container-defintions
argument (which includes "environment"
entries) will still be visible through processes like ps
. One of the AWS SDKs would give better peace of mind.