# TrafficShiftConfig

Configuration for traffic shift during progressive deployments.

- Source: [`aws-ecs/lib/base/base-service.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ecs/lib/base/base-service.ts#L144)
- Type last changed: v2.236.0 · 23 Jan 2026

## Example

```ts
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
declare const blueTargetGroup: elbv2.ApplicationTargetGroup;
declare const greenTargetGroup: elbv2.ApplicationTargetGroup;
declare const prodListenerRule: elbv2.ApplicationListenerRule;

const service = new ecs.FargateService(this, 'Service', {
  cluster,
  taskDefinition,
  deploymentStrategy: ecs.DeploymentStrategy.LINEAR,
  linearConfiguration: {
    stepPercent: 10.0,
    stepBakeTime: Duration.minutes(5),
  },
});

const target = service.loadBalancerTarget({
  containerName: 'web',
  containerPort: 80,
  alternateTarget: new ecs.AlternateTarget('AlternateTarget', {
    alternateTargetGroup: greenTargetGroup,
    productionListener: ecs.ListenerRuleConfiguration.applicationListenerRule(prodListenerRule),
  }),
});

target.attachToApplicationTargetGroup(blueTargetGroup);
```

## Properties

- `stepBakeTime`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — The duration to wait between traffic shifting steps.

  **Default:** Duration.minutes(6) for linear, Duration.minutes(10) for canary

  Valid values are 0 to 1440 minutes (24 hours).

- `stepPercent`: number — The percentage of production traffic to shift in each step.

  **Default:** 10.0 for linear, 5.0 for canary

  - For linear deployment: multiples of 0.1 from 3.0 to 100.0
  - For canary deployment: multiples of 0.1 from 0.1 to 100.0
