Skip to content
v2.278.0

WeightedTargetProperty Struct ​

An object that represents a target and its relative weight.

Traffic is distributed across targets according to their relative weight. For example, a weighted target with a relative weight of 50 receives five times as much traffic as one with a relative weight of 10. The total weight for all targets combined must be less than or equal to 100.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appmesh as appmesh } from 'aws-cdk-lib';
const weightedTargetProperty: appmesh.CfnRoute.WeightedTargetProperty = {
  virtualNode: 'virtualNode',
  weight: 123,

  // the properties below are optional
  port: 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_appmesh as appmesh

weighted_target_property = appmesh.CfnRoute.WeightedTargetProperty(
    virtual_node="virtualNode",
    weight=123,

    # the properties below are optional
    port=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.appmesh.*;

WeightedTargetProperty weightedTargetProperty = WeightedTargetProperty.builder()
        .virtualNode("virtualNode")
        .weight(123)

        // the properties below are optional
        .port(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.AppMesh;

var weightedTargetProperty = new WeightedTargetProperty {
    VirtualNode = "virtualNode",
    Weight = 123,

    // the properties below are optional
    Port = 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"

weightedTargetProperty := &WeightedTargetProperty{
	VirtualNode: jsii.String("virtualNode"),
	Weight: jsii.Number(123),

	// the properties below are optional
	Port: jsii.Number(123),
}

Properties ​

portoptionalnumberportoptionalint | floatportoptionalNumberPortoptionaldoublePortoptional*float64 #
The targeted port of the weighted object.
virtualNodestringvirtual_nodestrvirtualNodeStringVirtualNodestringVirtualNode*string required #
The virtual node to associate with the weighted target.
weightnumberweightint | floatweightNumberWeightdoubleWeight*float64 required #
The relative weight of the weighted target.