Skip to content

feat(ecs): add built-in Linear and Canary deployments #35981

Merged
mergify[bot] merged 15 commits intoaws:mainfrom
mazyu36:feat/ecs-linear-canary
Jan 19, 2026
Merged

feat(ecs): add built-in Linear and Canary deployments #35981
mergify[bot] merged 15 commits intoaws:mainfrom
mazyu36:feat/ecs-linear-canary

Conversation

@mazyu36
Copy link
Copy Markdown
Contributor

@mazyu36 mazyu36 commented Nov 7, 2025

Issue # (if applicable)

Closes #35986
Closes #35987

Reason for this change

Add new built-in Linear and Canary deployment strategies for ECS services to enable progressive and controlled production deployments.

Ref: Amazon ECS now supports built-in Linear and Canary deployments

Description of changes

  • Add CanaryConfiguration and LinearConfiguration interfaces to BaseServiceOptions
  • Extend DeploymentStrategy enum with LINEAR and CANARY values

Describe any new or updated permissions being added

N/A

Description of how you validated changes

Add unit tests and integ tests.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team November 7, 2025 13:30
@github-actions github-actions bot added p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Nov 7, 2025
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@aws-cdk-automation aws-cdk-automation dismissed their stale review November 9, 2025 07:55

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@github-actions github-actions bot added the feature-request A feature should be added or improved. label Nov 9, 2025
@mazyu36 mazyu36 marked this pull request as ready for review November 9, 2025 08:52
@mazyu36 mazyu36 changed the title feat(ecs): add built-in Linear and Canary deployments feat(ecs): add built-in Linear and Canary deployments Nov 9, 2025
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Nov 9, 2025
Copy link
Copy Markdown
Contributor

@kg-aws kg-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution. I have added my opinion to how we can implement this features in CDK L2 construct.

*/
readonly canaryBakeTime?: Duration;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given how similar these two interfaces are we can combine them in to single interface as following.

/**
 * Configuration for ECS service deployments (linear and canary)
 */
export interface TrafficShiftConfig {
  /**
   * The percentage of traffic to shift
   * @minimum 0.1 for canary, 3 for linear
   * @maximum 100
   */
  readonly stepPercent: number;

  /**
   * The number of minutes to wait between each step
   * @minimum 0
   * @maximum 1440
   */
  readonly stepBakeTime: Duration;
}

canaryConfiguration: props.canaryConfiguration ? {
canaryPercent: props.canaryConfiguration.canaryPercent,
canaryBakeTimeInMinutes: props.canaryConfiguration.canaryBakeTime?.toMinutes(),
} : undefined,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of setting values directly in the constructor, we can add methods that automatically configure the strategy along with the provided config. This way, existing users would only need to call these methods without modifying the constructor.

public configureLinearDeployment(config: TrafficShiftConfig): void {
    if (!this.isEcsDeploymentController) {
      throw new ValidationError('Linear configuration requires the ECS deployment controller.', this);
    }

    this.validateLinearConfiguration(config);

    // Update the deployment configuration with linear settings and set strategy to LINEAR
    const currentConfig = this.resource.deploymentConfiguration || {};
    this.resource.deploymentConfiguration = {
      ...currentConfig,
      strategy: DeploymentStrategy.LINEAR,
      linearConfiguration: {
        stepPercent: config.stepPercent,
        stepBakeTimeInMinutes: config.stepBakeTime.toMinutes(),
      },
    };
}

public configureCanaryDeployment(config: TrafficShiftConfig): void {
    if (!this.isEcsDeploymentController) {
      throw new ValidationError('Canary configuration requires the ECS deployment controller.', this);
    }

   this.validateCanaryConfiguration(config);

    // Update the deployment configuration with canary settings and set strategy to CANARY
    const currentConfig = this.resource.deploymentConfiguration || {};
    this.resource.deploymentConfiguration = {
      ...currentConfig,
      strategy: DeploymentStrategy.CANARY,
      canaryConfiguration: {
        canaryPercent: config.stepPercent,
        canaryBakeTimeInMinutes: config.stepBakeTime.toMinutes(),
      },
    };
}

@mazyu36
Copy link
Copy Markdown
Contributor Author

mazyu36 commented Nov 14, 2025

Thanks. I've updated.

Copy link
Copy Markdown
Contributor

@badmintoncryer badmintoncryer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've added a minor comment.

}

if (config.stepBakeTime !== undefined && !Token.isUnresolved(config.stepBakeTime)) {
const minutes = config.stepBakeTime.toMinutes();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to consider the case that stepBakeTime is set less than a minute such as 10 seconds.

I think this condition causes synth error.

if (!Number.isInteger(value) && integral) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.
I've added a validation.

@mazyu36 mazyu36 force-pushed the feat/ecs-linear-canary branch from 85ae667 to be9b40e Compare December 1, 2025 08:57
@aws-cdk-automation aws-cdk-automation added pr/needs-maintainer-review This PR needs a review from a Core Team Member and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Dec 1, 2025
@leonmk-aws leonmk-aws self-assigned this Jan 5, 2026
@leonmk-aws leonmk-aws added the pr/needs-integration-tests-deployment Requires the PR to deploy the integration test snapshots. label Jan 5, 2026
@leonmk-aws leonmk-aws had a problem deploying to deployment-integ-test January 5, 2026 12:14 — with GitHub Actions Failure
@mazyu36 mazyu36 had a problem deploying to deployment-integ-test January 15, 2026 07:13 — with GitHub Actions Error
@mazyu36 mazyu36 force-pushed the feat/ecs-linear-canary branch from 9e97232 to baf67dd Compare January 16, 2026 07:21
@mazyu36 mazyu36 had a problem deploying to deployment-integ-test January 16, 2026 07:21 — with GitHub Actions Error
@mazyu36 mazyu36 requested a review from leonmk-aws January 16, 2026 11:16
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 16, 2026
@mazyu36 mazyu36 had a problem deploying to deployment-integ-test January 19, 2026 03:29 — with GitHub Actions Error
@mergify mergify bot dismissed leonmk-aws’s stale review January 19, 2026 03:29

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 19, 2026
@mazyu36 mazyu36 requested a review from leonmk-aws January 19, 2026 04:14
Copy link
Copy Markdown
Contributor

@leonmk-aws leonmk-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution !

@leonmk-aws leonmk-aws removed the pr/needs-integration-tests-deployment Requires the PR to deploy the integration test snapshots. label Jan 19, 2026
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 19, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 19, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 19, 2026

Merge Queue Status

✅ The pull request has been merged at e8afe59

This pull request spent 44 minutes 58 seconds in the queue, including 29 minutes 12 seconds running CI.
The checks were run in-place.

Required conditions to merge

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 19, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 67ac5e7 into aws:main Jan 19, 2026
22 of 23 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

distinguished-contributor [Pilot] contributed 50+ PRs to the CDK feature-request A feature should be added or improved. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-ecs): support Canary Deployment (aws-ecs): support Linear Deployment

6 participants