- Newest
- Most votes
- Most comments
As described in this document, Blue/Green cannot be used when deploying to EC2 when setting up CodeDeploy in CloudFormation.
LoadBalancerInfo cannot be set together when DeploymentType is set to Blue/Green.
https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-deploymentstyle
If you specify this property with a blue/green deployment type, don't specify the AutoScalingGroups, LoadBalancerInfo, or Deployment properties.
For blue/green deployments, AWS CloudFormation supports deployments on Lambda compute platforms only. You can perform Amazon ECS blue/green deployments using AWS::CodeDeploy::BlueGreen hook. See Perform Amazon ECS blue/green deployments through CodeDeploy using AWS CloudFormation for more information.
This is a rediculous problem to have and CFN should absolutely support setting the LoadBalancerInfo when using Blue/Green deployments. I found a "workaround" but it's a 2-step process.
Steps:
- Define your non-blue/green CodeDeploy DeploymentGroup with the proper LoadBalancerInfo
- Deploy to CFN
- Change the CodeDeploy DeploymentGroup to blue/green
- Remove (comment out) the LoadBalancerInfo
- Deploy to CFN
- Discover that CFN doesn't reset the old LoadBalancers and just keeps using the existing ones
- Done
As long as you don't have to change the LoadBalancers this should work. At least until the CodeDeploy team updates their CFN resources properly.
Relevant content
- Accepted Answerasked 2 years ago
- asked 2 years ago
- asked a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
Thanks for pointing this out, i missed it.