Skip to content

Instantly share code, notes, and snippets.

@ktilcu
Created October 11, 2018 17:52
Show Gist options
  • Select an option

  • Save ktilcu/55786e164e9c4e7a1297ead04c38a553 to your computer and use it in GitHub Desktop.

Select an option

Save ktilcu/55786e164e9c4e7a1297ead04c38a553 to your computer and use it in GitHub Desktop.

Blue/Green/Canary Deployments on AWS ECS Fargate

Currently we duplicate at the service level which means we have to have

  • Weighted DNS
  • 2 Load Balancers
  • 2 Services
  • 2 sets of Tasks

Thats a lot of infrastructure to maintain, configure and adjust.

What if instead we used Tasks as our unit of duplication. They are way cheaper and easier to affect.

LB -> TargetGroup -> Taskv1, Taskv1, Taskv1
LB -> TargetGroup -> Taskv1, Taskv1, Taskv1, Taskv2
LB -> TargetGroup -> Taskv1, Taskv1, Taskv1, Taskv2, Taskv2
LB -> TargetGroup -> Taskv1, Taskv1, Taskv1, Taskv2, Taskv2, Taskv2
LB -> TargetGroup -> Taskv1, Taskv2, Taskv2, Taskv2
LB -> TargetGroup -> Taskv2, Taskv2, Taskv2

At any point we can rollback the count on Taskv2 or remove the rest of Taskv1.

Do you see any downsides?

@kian
Copy link

kian commented Oct 11, 2018

this is basically what ecs-deploy does when releasing - maybe some way to hook into that e.g., longer wait periods or more specific health checks (CW metrics?). one nice thing about your approach is much less redundant infra to create. and DNS is out of the picture so weighting is easier to adjust on the fly.

maybe a downside would be you have to launch more tasks to do more granular weighting (target group weights aren't supported).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment