1
votes

My architecture goes like,

Internal ALB -> Target Group 1 
                               \ 
                                 -> Fargate Task (using ECS Service)
                               /
External ALB -> Target Group 2 

This ECS service runs completely fine. I am able to hit the task using both the load balancers, for internal and external traffic.

I want to create a Blue/Green CodeDeploy Deployment Group corresponding to a CodeDeploy Application, that will successfully deploy the service whenever required. I am using CLI for all of this.

The problem is that since I am using two load balancers, I cannot associate both of them to create the CodeDeploy Deployment Group. Are there any pointers on how I can create this deployment group?

Also, I want to use this deployment group to create a pipeline so that the application can be deployed every time there is a code change.

Overall, I want to achieve that a service should be accessed internally within the VPC using internal ALB, and also externally using its public ALB. So I created both ALBs and created listeners for those ALBs, and then those target groups are attached to the ECS Service.

1

1 Answers

1
votes

Currently CodeDeploy does not support using multiple target groups, they are only supported when using a rolling update style of deployment 1 (non blue-green action):

Multiple target groups are only supported when the service uses the rolling update (ECS) deployment controller type. If you are using the CodeDeploy or an external deployment controller, multiple target groups are not supported.

If possible for the service the recommended workaround would be to use rolling ECS updates instead of Blue/Green CodeDeploy. If that is not possible the only other workaround would be to either split the service into two (one for each port) or develop a custom Lambda function that would run as part of a lifecycle hook 2, the Lambda function would have to take care of setting up the additional target group.