How would you implement a canary or weighted rollout using load balancers?
AdvancedConceptLoad Balancers, Proxies & CDNs
Answer
With an ALB, create two target groups and a forward action with weights (for example 95/5), watch error rate and latency per target group, then shift gradually. Route 53 weighted records can do it across load balancers but are subject to DNS caching.
aws elbv2 modify-listener --listener-arn $L --default-actions \
'Type=forward,ForwardConfig={TargetGroups=[{TargetGroupArn=blue,Weight=95},{TargetGroupArn=green,Weight=5}]}'
Automate rollback on SLO breach with CodeDeploy, Argo Rollouts or Flagger.
More on Load Balancers, Proxies & CDNs
What is a load balancer and why do we use one?BeginnerWhat is the difference between L4 and L7 load balancing?IntermediateCompare ALB, NLB, GWLB and Classic Load Balancer in AWS.IntermediateWhat load-balancing algorithms are common?BeginnerWhat are health checks and how should they be designed?AdvancedWhat is connection draining (deregistration delay)?Intermediate