我使用CF为CodeDeploy应用程序创建部署组,但我一直收到错误消息,说部署组已经存在(它确实存在,但它属于不同的CodeDeploy应用程序)。如果我手动创建它,它很好。这是模板:
"DeploymentGroup": {
"Description": "Create a deployment group",
"DependsOn": [
"EC2Instance"
],
"Type" : "AWS::CodeDeploy::DeploymentGroup",
"Properties" : {
"ApplicationName" : "Foo",
"DeploymentConfigName": "CodeDeployDefault.AllAtOnce",
"DeploymentGroupName": "foo-group",
"Ec2TagFilters" : [
{
"Key" : "Name",
"Value" : "Foo",
"Type" : "KEY_AND_VALUE"
}
],
"ServiceRoleArn" : "...."
}
},
答案 0 :(得分:0)
部署组名称必须与适用的IAM用户或AWS账户唯一
相关文档:http://docs.aws.amazon.com/codedeploy/latest/APIReference/API_CreateDeploymentGroup.html
答案 1 :(得分:0)
如果部署组名称作为CF堆栈的一部分创建,则它必须是唯一的,因为它的名称类型为:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html
我通过将应用程序名称添加到部署组名称来解决这个问题。
DeploymentGroup:
Type: "AWS::CodeDeploy::DeploymentGroup"
Properties:
ApplicationName: !Ref DeployApplication
DeploymentGroupName: !Sub "${DeployApplication}_${DeploymentGroupName}"
ServiceRoleArn: !GetAtt CodeDeployServiceRole.Arn