CloudFormation无法创建CodeDeploy DeploymentGroup

时间:2019-05-02 23:19:22

标签: amazon-web-services amazon-cloudformation aws-code-deploy

我正在尝试整合一些CloudFormation来设置CodePipeline,以从Github部署到ECS / Fargate。

但是,我始终收到错误消息:

For ECS deployment group, ec2TagFilters can not be specified (Service: AmazonCodeDeploy; Status Code: 400; Error Code: InvalidEC2TagException;

每当我尝试站起CloudFormation堆栈时。但是,我的文件中根本没有'ec2TagFilters'。

我能找到的唯一对此问题的参考是一个较旧的StackOverflow question,但它们针对的是Lambda,建议的“修复”对我不起作用。

CF YAML的相关代码段:

    ExampleApp:
      Type: AWS::CodeDeploy::Application
      Properties:
        ApplicationName: !Join [ "-", [ "example", !Ref "Environment" ] ]
        ComputePlatform: ECS

    ExampleDeploymentGroup:
      Type: AWS::CodeDeploy::DeploymentGroup
      Properties:
        ApplicationName: !Ref ExampleApp
        DeploymentGroupName: !Join [ "-", [ "example", !Ref "Environment"] ]
        ServiceRoleArn: !Ref ServiceRoleArn

2 个答案:

答案 0 :(得分:0)

我从来没有这个工作。但是,我意识到我不需要设置Application / DeploymentGroup。

CodeDeploy可以在“部署”步骤中将“ ECS”用作提供者,从而消除了此必要。

对于任何在这里结束的人都是CF:

- Name: Deploy
  Actions:
    - Name: Deploy
      RunOrder: 2
      InputArtifacts:
        - Name: AppBuilt
      ActionTypeId:
        Category: Deploy
        Owner: AWS
        Version: 1
        Provider: ECS
      Configuration:
        ClusterName: !Ref EcsCluster
        ServiceName: !Ref EcsService

答案 1 :(得分:0)

从AWS文档中

通过CodeDeploy的

ECS蓝色/绿色部署不使用AWS :: CodeDeploy :: DeploymentGroup资源。

请参阅:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html