Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECS Fargate Service: Alarm based rollback is not supported (cn-north-1) #26574

Closed
YikaiHu opened this issue Jul 30, 2023 · 6 comments
Closed
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@YikaiHu
Copy link

YikaiHu commented Jul 30, 2023

Describe the bug

In version v2.89.0,

    const service = new ecs.FargateService(this, `Service`, {
      cluster: ecsCluster,
      desiredCount: 2, // This number must larger than the number of NLB AZs
      taskDefinition: taskDefinition,
      vpcSubnets: {
        subnets: taskSubnets,
      },
      securityGroups: [ecsServiceSG],
      assignPublicIp: false,
      minHealthyPercent: 100,
      maxHealthyPercent: 200,
      propagateTags: ecs.PropagatedTagSource.SERVICE,
      enableECSManagedTags: true,
      enableExecuteCommand: true,
    });

will trigger the CDK deployment failure:

image

Resource handler returned message: "Alarm based rollback is not supported. (Service: AmazonECS; Status Code: 400; Error Code: UnsupportedFeatureException; Request ID: a76f0b28-829f-40dc-ad32-11ff095a3d22; Proxy: null)" (RequestToken: 1fc816d1-763b-edf2-813f-52938aac2e50, HandlerErrorCode: GeneralServiceException)

This may caused by: from #25840, ECS L2 construct sets the default configuration for the CfnService.deploymentConfiguration.alarms property to:

alarmNames: [],
rollback: false,
enable: false,

But it seems like that not all AWS region support this feature.

Expected Behavior

Deployment successfully

Current Behavior

CDK deployment failed

Resource handler returned message: "Alarm based rollback is not supported. (Service: AmazonECS; Status Code: 400; Error Code: UnsupportedFeatureException; Request ID: a76f0b28-829f-40dc-ad32-11ff095a3d22; Proxy: null)" (RequestToken: 1fc816d1-763b-edf2-813f-52938aac2e50, HandlerErrorCode: GeneralServiceException)

Reproduction Steps

    const service = new ecs.FargateService(this, `Service`, {
      cluster: ecsCluster,
      desiredCount: 2, // This number must larger than the number of NLB AZs
      taskDefinition: taskDefinition,
      vpcSubnets: {
        subnets: taskSubnets,
      },
      securityGroups: [ecsServiceSG],
      assignPublicIp: false,
      minHealthyPercent: 100,
      maxHealthyPercent: 200,
      propagateTags: ecs.PropagatedTagSource.SERVICE,
      enableECSManagedTags: true,
      enableExecuteCommand: true,
    });

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

v2.89.0

Framework Version

No response

Node.js Version

nodejs16

OS

MacOS

Language

Typescript

Language Version

No response

Other information

No response

@YikaiHu YikaiHu added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 30, 2023
@github-actions github-actions bot added the @aws-cdk/aws-ecs Related to Amazon Elastic Container label Jul 30, 2023
@pahud
Copy link
Contributor

pahud commented Jul 31, 2023

Thank you for your feedback.

Have you tried to remove the "Rollback": false property with addPropertyDeletionOverride?

(service.node.tryFindChild('Service') as ecs.CfnService).addPropertyDeletionOverride('DeploymentConfiguration.Alarms.Rollback')

If this works in CN regions, we probably should add a condition for that.

@pahud pahud added p2 effort/medium Medium work item – several days of effort response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Jul 31, 2023
@YikaiHu
Copy link
Author

YikaiHu commented Aug 1, 2023

Thanks Pahub, nice to meet you again hahaha.

Yes, I use addPropertyDeletionOverride to solve this issue finally.

Here is my code:

.....

Aspects.of(this).add(new InjectRemoveECSAlarm());

....

class InjectRemoveECSAlarm implements IAspect {
  public visit(node: IConstruct): void {
    if (
      node instanceof CfnResource &&
      node.cfnResourceType === "AWS::ECS::Service"
    ) {
      node.addDeletionOverride(
        "Properties.DeploymentConfiguration.Alarms"
      );
    }
  }
}

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Aug 1, 2023
@peterwoodworth
Copy link
Contributor

This was fixed, #26458 correct?

@peterwoodworth peterwoodworth added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Aug 7, 2023
@github-actions
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Aug 10, 2023
@pahud
Copy link
Contributor

pahud commented Aug 23, 2023

@YikaiHu
Copy link
Author

YikaiHu commented Aug 28, 2023

Yes, it worked, no more injection is needed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants