ECS Service - Automating deploy with new Docker image

后端 未结 3 2094
耶瑟儿~
耶瑟儿~ 2021-02-05 06:18

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

3条回答
  •  借酒劲吻你
    2021-02-05 07:20

    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.

提交回复
热议问题