Reputation: 187
I have ECS fargate cluster.I am working on CICD to push images to ECR repository and then update the cluster.I am using latest tag in my repositories.
By using below way i used to do it manually. Create new version of task definition ----> Update the service with new version of task definition ---> Stop the task with old version.
Now when i am trying to automate this from Jenkins i am using AWSCLI.
I have one question.If i use below command will it create a new version of task definition and update service ? OR i have to create a new version of task definition first.
aws ecs update-service --cluster ec2cluster_name --service service_name --force-new-deployment
Upvotes: 0
Views: 1416
Reputation: 1130
If you are updating/using the same image tag then when you do forceNewDeployment
it will fetch the latest image from the repository and updates the ECS service.
The ecs-update-service documentation says:
If your updated Docker image uses the same tag as what is in the existing task definition for your service (for example, my_image:latest ), you do not need to create a new revision of your task definition. You can update the service using the forceNewDeployment option. The new tasks launched by the deployment pull the current image/tag combination from your repository when they start.
https://docs.aws.amazon.com/cli/latest/reference/ecs/update-service.html
The above command will not create new task definition and to create a task definciiton have a look at register-task-definition
Upvotes: 1