Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deployment group's ECS service must be configured for a CODE_DEPLOY deployment controller

I've encountered following error when I'm trying to create Deployment Group for ECS Cluster in Code Deploy. I've created IAM that based on CodeDeploy ECS and its policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "ecs:DescribeServices",
                "ecs:CreateTaskSet",
                "ecs:UpdateServicePrimaryTaskSet",
                "ecs:DeleteTaskSet",
                "elasticloadbalancing:DescribeTargetGroups",
                "elasticloadbalancing:DescribeListeners",
                "elasticloadbalancing:ModifyListener",
                "elasticloadbalancing:DescribeRules",
                "elasticloadbalancing:ModifyRule",
                "lambda:InvokeFunction",
                "cloudwatch:DescribeAlarms",
                "sns:Publish",
                "s3:GetObject",
                "s3:GetObjectMetadata",
                "s3:GetObjectVersion"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "iam:PassRole"
            ],
            "Effect": "Allow",
            "Resource": "*",
            "Condition": {
                "StringLike": {
                    "iam:PassedToService": [
                        "ecs-tasks.amazonaws.com"
                    ]
                }
            }
        }
    ]
}

Please let me know when I made mistake?

enter image description here

like image 485
PPShein Avatar asked Jun 10 '19 04:06

PPShein


People also ask

What must be supplied to CodeDeploy to specify the ECS service to deploy?

The Amazon ECS service's deployment controller must be set to CodeDeploy. The production listener, an optional test listener, and target groups used during a deployment.

What is ECS deployment?

An Amazon ECS deployment type determines the deployment strategy that your service uses. There are three deployment types: rolling update, blue/green, and external. You can view information about the service deployment type on the service details page, or by using the describe-services API.

What is blue green deployment in AWS?

A blue/green deployment is a deployment strategy in which you create two separate, but identical environments. One environment (blue) is running the current application version and one environment (green) is running the new application version.


2 Answers

If you are using CodeDeploy, your ECS service has to be defined so that it uses Blue/Green code deployments rather than Rolling Updates:

snapshot of AWS Management Console > ECS > Create Service

HTH!

like image 159
diginoise Avatar answered Oct 21 '22 00:10

diginoise


Also if you are using terraform you can simply fix it by add this to aws_ecs_service:

  deployment_controller {
      type = "CODE_DEPLOY"
  }
like image 9
Roman Avatar answered Oct 21 '22 01:10

Roman