I'm trying to convert our old CodeDeploy DeploymentGroup from an "IN_PLACE" deployment type to a "BLUE_GREEN" deployment type using CloudFormation. Everything seems to be working pretty well except that I can't seem to figure out how to configure the ASG.
I want to copy the existing ASG and have it create new EC2 instances. However, changing the "GreenFleetProvisioningOption" to use the "COPY_AUTO_SCALING_GROUP" action causes CloudFormation throw an error with the message:
Property AutoScalingGroups cannot be specified.
If I remove the "AutoScalingGroups" from the CFN template I get this error:
Exactly one AutoScaling group must be specified when selecting the COPY_AUTO_SCALING_GROUP green fleet provisioning option.
I've looked in the docs but I can't find a way to specify a single ASG. Is this a bug? If so, where do we file a bug report? Is this by design? If so, why can I configure this through the Console, or API, or CLI but not through CFN?
Here's the relevant part of my template:
"cddgsg": {
"Type": "AWS::CodeDeploy::DeploymentGroup",
"Properties": {
"AutoRollbackConfiguration": {"Enabled": true, "Events": ["DEPLOYMENT_FAILURE"]},
"BlueGreenDeploymentConfiguration": {
"DeploymentReadyOption": {"ActionOnTimeout": "CONTINUE_DEPLOYMENT"},
"GreenFleetProvisioningOption": {"Action": "COPY_AUTO_SCALING_GROUP"},
"TerminateBlueInstancesOnDeploymentSuccess": {"Action": "TERMINATE", "TerminationWaitTimeInMinutes": 1}
},
"DeploymentConfigName": "CodeDeployDefault.AllAtOnce",
"DeploymentStyle": {"DeploymentOption": "WITH_TRAFFIC_CONTROL", "DeploymentType": "BLUE_GREEN"},
"AutoScalingGroups": [{"Ref": "asgmyappsg"}],
"ServiceRoleArn": {"Fn::GetAtt": ["iamrdeployer", "Arn"]},
"DeploymentGroupName": "sg",
"ApplicationName": "myapp-sg"
}
},
I'm guessing that the fact that it mostly works is just a fluke, correct? I mean I was able to use CFN to configure almost everything about my Blue/Green deployment, except "COPY_AUTO_SCALING_GROUP" (and LoadBalancers, but I have a workaround for that one).
Is there any thought as to when CFN might be able to support Blue/Green deployments to EC2?
I don't know when I will support it either. https://github.com/aws-cloudformation