AWS Lambda Traffic Shift
Route a percentage of Lambda function traffic to a new version via a weighted alias.
The AWS Lambda Traffic Shift step updates the weighted alias created by the Canary Deploy step to route a specified percentage of traffic to the new function version. Add multiple Traffic Shift steps in sequence to progressively increase traffic — for example, 10% then 100%.
Before you begin
An AWS Lambda Canary Deploy step earlier in the same stage. The Traffic Shift step requires the function name and version from the Canary Deploy step output.
A Lambda infrastructure. Go to Lambda infrastructure.
For ZIP artifact canary deployments, ensure your service includes an alias definition. For ECR image canary deployments, no alias definition is required — the canary deploy step manages the alias automatically. Go to Lambda services.
Step YAML
- name: AWS Lambda Traffic Shift 10
id: awsLambdaTrafficShift10
template:
uses: awsLambdaTrafficShiftStep
with:
traffic_percentage: "10"
function_name: <+stage.steps.awsLambdaCanaryDeployStep.output.outputVariables.functionName>
function_version: <+stage.steps.awsLambdaCanaryDeployStep.output.outputVariables.version>The function_name and function_version inputs are wired to the Canary Deploy step's output variables. These expressions ensure each traffic shift targets the exact version published in the same stage execution.
For the final 100% shift:
Configure the step
Top-level fields
Name
Display name for this step in the stage canvas.
Yes
Traffic Percentage
The percentage of invocations to route to the new function version. Must be between 0 and 100. Set to 100 on the final shift step to complete the promotion.
Yes
Service Configuration
These fields are auto-populated from the Canary Deploy step output. You do not need to change them when the Traffic Shift step follows a Canary Deploy step in the same stage.
Field
with: key
Expression
Description
Function Name
function_name
<+stage.steps.awsLambdaCanaryDeployStep.output.outputVariables.functionName>
The Lambda function name, passed from the Canary Deploy step output.
Function Version
function_version
<+stage.steps.awsLambdaCanaryDeployStep.output.outputVariables.version>
The published version number of the new function, passed from the Canary Deploy step output.
Infrastructure Configuration
AWS Connector
${{infra.connectorRef}}
The AWS connector resolved from the infrastructure definition.
AWS Region
${{infra.region}}
The AWS region resolved from the infrastructure definition.
Add intermediate shifts
The default canary stage includes two Traffic Shift steps: 10% and 100%. To add an intermediate step (for example, 50%), click + between the existing shift steps on the stage canvas and add another Traffic Shift step. Set Traffic Percentage to the desired value.
You can also insert approval gates or verification steps between any two traffic shift steps to validate the canary before increasing traffic further.
Advanced settings
Timeout duration: Maximum time the step is allowed to run before being terminated.
On failure: Define what happens if the step fails.
Strategy: Configure a looping strategy.
Conditional execution: Run this step only when a condition is true.
Next steps
Go to AWS Lambda Canary Deploy for the step that publishes the new version and creates the alias.
Go to AWS Lambda Canary Rollback for the step that resets traffic on failure.
Go to Lambda canary deployment for the full canary flow walkthrough.
Last updated
Was this helpful?