Skip to content

ECS Fargate Service: service not created because of alarm based rollback #26307

@srshkmr

Description

@srshkmr

Describe the bug

During the deployment process with the same code which was working previously is returning the following error.

4:43:04 pm | CREATE_FAILED        | AWS::ECS::Service                               | xxxx
Resource handler returned message: "Invalid request provided: CreateService error: Alarm based rollback feature is only supported with ECS deployment controller. Update t
o ECS deployment controller and try again. (Service: AmazonECS; Status Code: 400; Error Code: InvalidParameterException; Request ID: xxx;
Proxy: null)" (RequestToken: xxx, HandlerErrorCode: InvalidRequest)

The following is my ECS deployment group

const ecsDeploymentGroup = new codeDeploy.EcsDeploymentGroup(this, 'ecsDeploymentGroup', {
      application: ecsApplication,
      deploymentGroupName: props.ECSTaskFamilyName,
      deploymentConfig,
      alarms: ecsServiceAlarms.alarms,
      service: ecsBlueGreenService.ecsService,
      blueGreenDeploymentConfig: {
        blueTargetGroup: ecsBlueGreenService.blueTargetGroup,
        greenTargetGroup: ecsBlueGreenService.greenTargetGroup,
        listener: ecsBlueGreenService.albProdListener,
        testListener: ecsBlueGreenService.albHttpsListener,
        terminationWaitTime: Duration.minutes(10),
      },
      autoRollback: {
        stoppedDeployment: true,
      }
    });

The application is deployed using Code deploy, So the deployment controller is set as CODE_DEPLOY

this.ecsService = new ecs.FargateService(this, 'FargateService', {
      cluster: props.cluster!,
      desiredCount: 1,
      taskDefinition,
      minHealthyPercent: 100,
      maxHealthyPercent: 200,
      enableExecuteCommand: true,
      deploymentController: {
        type: DeploymentControllerType.CODE_DEPLOY
      },
      healthCheckGracePeriod: Duration.seconds(60)
    });

Expected Behavior

ECS Cluster gets deployed successfully

Current Behavior

ECS creation failed

Reproduction Steps

Use the code in the bug description

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.87.0

Framework Version

No response

Node.js Version

v18.15.0

OS

MacOS 14.0

Language

Typescript

Language Version

5.1.6

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ecsRelated to Amazon Elastic ContainerbugThis issue is a bug.p1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions