interface TrafficShiftConfig
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ECS.TrafficShiftConfig |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsecs#TrafficShiftConfig |
Java | software.amazon.awscdk.services.ecs.TrafficShiftConfig |
Python | aws_cdk.aws_ecs.TrafficShiftConfig |
TypeScript (source) | aws-cdk-lib » aws_ecs » TrafficShiftConfig |
Configuration for traffic shift during progressive deployments.
Example
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
| Name | Type | Description |
|---|---|---|
| step | Duration | The duration to wait between traffic shifting steps. |
| step | number | The percentage of production traffic to shift in each step. |
stepBakeTime?
Type:
Duration
(optional, default: Duration.minutes(6) for linear, Duration.minutes(10) for canary)
The duration to wait between traffic shifting steps.
Valid values are 0 to 1440 minutes (24 hours).
stepPercent?
Type:
number
(optional, default: 10.0 for linear, 5.0 for canary)
The percentage of production traffic to shift in each step.
- 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

.NET
Go
Java
Python
TypeScript (