Nâng CaoAWS & Cloud iconAWS & Cloud

Blue/Green deployment và Canary deployment trên AWS là gì? Giải thích cách implement từng strategy.

Blue/Green deployment: duy trì hai environment giống nhau (Blue = production hiện tại, Green = version mới); deploy và test Green hoàn toàn, sau đó switch traffic 100% từ Blue sang Green (thường qua Route 53 DNS swap hoặc ALB listener rule update); rollback instant bằng switch lại Blue; Blue environment giữ lại một thời gian rồi mới terminate.

Implement Blue/Green trên AWS:

  1. EC2 + ALB: tạo Target Group mới cho Green, register instances mới, test qua staging URL, update ALB listener rule để point sang Green TG
  2. ECS: CodeDeploy blue/green cho ECS — tự động tạo task set mới, shift traffic theo schedule, rollback nếu alarm trigger
  3. Lambda: Lambda aliases với CodeDeploy, shift traffic theo Linear/Canary/AllAtOnce deployment config

Canary deployment là biến thể của blue/green: thay vì switch 100% ngay, shift dần một tỷ lệ nhỏ traffic sang version mới (5%, 10%, 25%, 50%, 100%) trong khoảng thời gian, monitor metrics/errors ở mỗi bước; nếu metric xấu thì rollback, nếu OK thì tiếp tục tăng. API Gateway có built-in canary release — shift % traffic sang new stage. Route 53 Weighted routing cho canary ở DNS level. CloudWatch alarms trigger automatic rollback khi error rate vượt threshold.

Canary an toàn hơn cho big changes, blue/green nhanh hơn khi confident với version mới.

Xem toàn bộ AWS & Cloud cùng filter theo level & chủ đề con.

Mở danh sách AWS & Cloud