I have a sample script which creates EC2, CodeBuild, CodeDeploy and its Deployment Group with ALB and then it goes further to setup with codePipeline, however I am getting an error on CodeDeployDeploymentGroup stage,
Error –
CodeDeployDeploymentGroup
CREATE_FAILED
Likely root cause
The target group name arn:aws:elasticloadbalancing:us-west-2:363010889649:targetgroup/SampleTG/75497adb8b9bc9b8 specified in targetGroupInfoList exceeds the maximum allowed length of 32 characters.
here is the sample script
what could be the issue? I have tried shorting the names, so I am not sure what could be the problem here.
2
Answers
As seen in the CloudFormation documentation
you should use the Name property of the target group, or the TargetGroupName attribute with the Fn::GetAtt intrinsic function, as shown in the following example
In your code, inside
CodeDeployDeploymentGroup
, you’re using:which returns the ARN of the target group. Instead, as written in the documentation, you should use
Fn::GetAtt
to get the name of the group so that it would look like this:Your CloudFormation template for setting up a CI/CD pipeline looks quite comprehensive.Here’s a refined version of your template with some improvements:
Above CF template follows security best practices.