0
votes

I have setup code pipeline for end to end automatic deployment of revision on EC2 instances using cloudformation template, the deployment group is of type blue/green for codedploy.

But I dont understand how to keep the code deployment group in sync with newly created auto scaling group (green).

Do I have to create new lambda invoke action in pipeline after successful deployment to update the newly created auto scaling group name.

1
I am not managing code deploy via CF but managing the individual pieces like EC2 instances, LB, ASG etc using cloud formation. But does CF has the capability to manage code deployment group in Blue/Green style. Please share some docs which I can refer. - prassank
Yes, CFN can manage and provision all resources for blue/geen ECS deployment for you as described here. - Marcin
ECS I know but how to do the same with EC2 - prassank

1 Answers

0
votes

Unfortunately, CloudFormation does not support Blue/Green deployments for EC2 platform:

For blue/green deployments, AWS CloudFormation supports deployments on Lambda compute platforms only.

Support for ECS is very new.

To create deployment group for blue/green for EC2 platform you would have to create a custom resource in CloudFormation .

The custom resource would be based on a lambda function, and in that lambda function you would use create_deployment_group to define blue/green details for your EC2 instances. As part of this process, you will have an option to choose how to deal with AutoScaling group, e.g.

        "greenFleetProvisioningOption": {
             "action": "COPY_AUTO_SCALING_GROUP"
        }

For creation of custom resource, crhelper by AWS is very useful.

Hope this helps and hope Blue/Green for EC2 will be supported by CloudFormation soon.