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 個回答
0
已接受的答案

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
專家
已回答 1 年前
profile picture
專家
已審閱 1 個月前
  • Thanks this fixed it for me, i see i formated it wrongly.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南