Possibility to Perform Fargate ECS blue/green deployments with CDK
Is it possible to synth a template like mentioned in the document https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/blue-green.html ? Or any other way to perform this Fargate ECS blue/green deployments with CDK?
Use Case
Proposed Solution
Other
- [ ] :wave: I may be able to implement this feature request
- [ ] :warning: This feature might incur a breaking change
This is a :rocket: Feature Request
I implemented Blue/Green deployment recently in our SaaS solution and as far as I know it is currently not possible in the CDK.
What we ended up doing is to create an initial task definition A for the very first CDK stack deployment. The following deployments create a new task definition A' which has the same 'family' property set.
Next, we created a CodeDeploy pipeline which uses the Blue/Green deployment strategy and references the task definition A'. This works well. Actually, we decoupled the creation of task set and its deployment.
I noticed that CloudFormation provides support for Blue/Green deployments in ECS since May 19, 2020. [1][2]
That is, the CDK will be able to provide this functionality in the future, too. Is this on the roadmap already?
References
[1] https://aws.amazon.com/about-aws/whats-new/2020/05/aws-cloudformation-now-supports-blue-green-deployments-for-amazon-ecs/?nc1=h_ls [2] https://docs.aws.amazon.com/en_us/AWSCloudFormation/latest/UserGuide/blue-green.html
@MartinLoeper Did you use CDK to create CodeDeploy pipeline for Blue/Green as you mentioned:
Next, we created a CodeDeploy pipeline which uses the Blue/Green deployment strategy and references the task definition A'. This works well. Actually, we decoupled the creation of task set and its deployment. ?
@uttarasridhar @SomayaB When do you think we may have ability to use CDK to create CodeBuild action for ECS Fargate Blue/Green Deployments?
Any updates to this issue? Would be nice to have this in CDK - I might be able to take a look at implementing this as I’ve got a rough CDK application that deploys using this and should be fairly easy to put into a ECS pattern
Hey there, we are working to implement this. Gonna close in favor of https://github.com/aws/aws-cdk/issues/1559
@richardhughes any contribution is super appreciated! if you want to make a PR or even a separate library (or just a gist) to help illustrate what we need to do it would be a big help. Using this doc as a starting place, but code would definitely help. Post anything relevant in #1559