Skip to content
v2.277.0

VersionWeight Struct ​

A version/weight pair for routing traffic to Lambda functions.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lambda as lambda } from 'aws-cdk-lib';

declare const version: lambda.Version;
const versionWeight: lambda.VersionWeight = {
  version: version,
  weight: 123,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_lambda as lambda_

# version: lambda.Version

version_weight = lambda.VersionWeight(
    version=version,
    weight=123
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.lambda.*;

Version version;

VersionWeight versionWeight = VersionWeight.builder()
        .version(version)
        .weight(123)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Lambda;

Version version;

var versionWeight = new VersionWeight {
    Version = version,
    Weight = 123
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var version Version

versionWeight := &VersionWeight{
	Version: version,
	Weight: jsii.Number(123),
}

Properties ​

versionIVersionversionIVersionversionIVersionVersionIVersionVersionIVersion required #
The version to route traffic to.
weightnumberweightint | floatweightNumberWeightdoubleWeight*float64 required #
How much weight to assign to this version (0..1).