# TrafficRouting

Represents how traffic is shifted during a CodeDeploy deployment.

Extends: TrafficRouting
Superclass of: AllAtOnceTrafficRouting, TimeBasedCanaryTrafficRouting, TimeBasedLinearTrafficRouting

- Source: [`aws-codedeploy/lib/traffic-routing-config.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-codedeploy/lib/traffic-routing-config.ts#L59)
- Type last changed: v2.45.0 · 6 Oct 2022

## Example

```ts
const config = new codedeploy.LambdaDeploymentConfig(this, 'CustomConfig', {
  trafficRouting: new codedeploy.TimeBasedCanaryTrafficRouting({
    interval: Duration.minutes(15),
    percentage: 5,
  }),
  deploymentConfigName: 'MyDeploymentConfig',
});
```

## Initializer

```ts
new TrafficRouting()
```

## Methods

- `allAtOnce(): TrafficRouting // chainable` (static) — Shifts 100% of traffic in a single shift.

- `bind(scope: Construct): TrafficRoutingConfig` — Returns the traffic routing configuration.

- `timeBasedCanary(props: TimeBasedCanaryTrafficRoutingProps): TrafficRouting // chainable` (static) — Shifts a specified percentage of traffic, waits for a specified amount of time, then shifts the rest of traffic.

- `timeBasedLinear(props: TimeBasedLinearTrafficRoutingProps): TrafficRouting // chainable` (static) — Keeps shifting a specified percentage of traffic until reaching 100%, waiting for a specified amount of time in between each traffic shift.
