0
votes

I am working on a CI/CD pipeline on AWS. For the given information, I have to use GitLab as the repository and use Blue/Green Deployment as the deployment method for ECS Fargate. I would like to use CodeDeploy(preset in the template of Cloudformation) and trigger it by each commit push to GitLab. I cannot use CodePipeline in my region so using CodePipeline is not work for me.

I have read so much docs and webpage related to ECS fargate and B/G deployment. But it seems not much information can help. Are there anyone have related experience?

1
Your question is a bit open ended, not certain you need help with setting up GitLab to trigger an update to the CloudFormation stack, or setting up your automation to do a B/G deployment with ECS Fargate.peter n
Actually, i am planning to have two pipeline, one is include create/updating cloudformation stack, one is automation to do a B/G deployment with ECS Fargate. maybe I can focus working on B/G deployment with ECS Fargate. Will it be more clear to you?Yuk Chan

1 Answers

0
votes

If your goal is Zero Down Time, ECS already comes packaged as so by default, but not in what I'd call Blue/Green deployment, but rather a rolling upgrade. You'll have the ability to control percentage of healthy instances, ensuring no downtime, with ECS draining connections from the old tasks and provisioning new tasks with new versions.

Your application must be able to handle this 'duality' in versions, e.g. on the data layer, UX etc.

If Blue/Green is an essential requirement, you'll have to leverage CodeDeploy and ALB with ECS. Without going into implementation details, here's the highlight of it:

  • You have two sets of: Task Definitions and Target Groups (tied to one ALB)
  • Code Deploy deploys new task definition, which is tied to the green Target Group. Leaving blue as is.
  • Test your green deployment by configuring a test listener to the new target group.
  • When testing is complete, switch all/incremental traffic from blue to green (ALB rules/weighted targets)
  • Repeat the same process on the next update, except you'll be going from green to red.

Parts of what I've described are handled by CodeDeploy, but hopefully this gives you an idea of the solution architecture, hence how to automate. ECS B/G.