@shinyaz

ECS update-service can dynamically switch between Linear and Canary

1 min read

I assumed switching an ECS service from Linear to Canary deployment would require recreating the service.

Turns out, just passing a different strategy in --deployment-configuration to update-service does the trick.

Terminal
aws ecs update-service --cluster my-cluster \
  --service my-service \
  --task-definition my-task:2 \
  --deployment-configuration '{
    "maximumPercent":200,"minimumHealthyPercent":100,
    "strategy":"CANARY","bakeTimeInMinutes":1,
    "canaryConfiguration":{"canaryPercent":10,"canaryBakeTimeInMinutes":1}
  }'

The load balancer configuration (target groups, listeners, infra role) is already set at service creation time, so switching strategies only requires --deployment-configuration. Used this in my NLB Linear / Canary verification article.

Share this post

Shinya Tahara

Shinya Tahara

Solutions Architect @ AWS

I'm a Solutions Architect at AWS, providing technical guidance primarily to financial industry customers. I share learnings about cloud architecture and AI/ML on this site.The views and opinions expressed on this site are my own and do not represent the official positions of my employer.