CodeDeploy::DeploymentGroup Error: The list of target group pairs must have exactly one pair

0

I am creating a cloudformation nestedDeployment(CodeBuild Project and CodeDeploy Application) with a Blue/Green Deployment, for an ECS (Fargate Managed) Deployment. The Deployment fails in the creation of the CodeDeployment Group with this error:

"The list of target group pairs must have exactly one pair (Service: AmazonCodeDeploy; Status Code: 400; Error Code: InvalidTargetGroupPairException; Request ID: xxxxxx)"

My nested Deployment has an alb and the ouputs are seen in this deployment as importvalues, the output values are - ECSTargetGroup1Name, ECSTargetGroup1Name (With the export from the alb as - Value: !GetAtt ECSTargetGroup1.TargetGroupName and Value: !GetAtt ECSTargetGroup2.TargetGroupName). Same applies for the ECS ClusterName with its output-export in it's yaml file.

My two cents in understanding this error is suggesting i may have declared wrongly the target groups in the TargetGroupPairInfoList.

Any help with this will be appreciated.

An excerpt of my code is this,

Enter image description here

Enter image description here

Enter image description here

Enter image description here Resources:

1 Answer
0
Accepted Answer

Hi, at https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-loadbalancerinfo.html it says TargetGroupPairInfoList is "an array of TargeGroupPairInfo objects with a maximum size of one". You've provided an array with 3 elements in it.

What you need is:

TargetGroupPairInfoList:
- ProdTrafficRoute:     # 03:10 UTC I just edited this as in my haste earlier I forgot the "-".  Had a sudden realisation while brushing my teeth (it's 11:10PM here). :)
    TrafficRoute
  TargetGroups: 
    - TargetGroupInfo
  TestTrafficRoute: 
    TrafficRoute

Not this:

TargetGroupPairInfoList:
- ProdTrafficRoute: 
    TrafficRoute
- TargetGroups: 
    - TargetGroupInfo
- TestTrafficRoute: 
    TrafficRoute
EXPERT
answered a year ago
profile picture
EXPERT
reviewed 21 days ago
  • Thanks this fixed it for me, i see i formated it wrongly.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions