Skip to content
v2.278.0

ClientRoutingPolicy Enum ​

Indicates how traffic is distributed among the load balancer Availability Zones.

Example ​

ts
declare const vpc: ec2.Vpc;

const lb = new elbv2.NetworkLoadBalancer(this, 'LB', {
  vpc,
  // Whether deletion protection is enabled.
  deletionProtection: true,

  // Whether cross-zone load balancing is enabled.
  crossZoneEnabled: true,

  // Whether the load balancer blocks traffic through the Internet Gateway (IGW).
  denyAllIgwTraffic: false,

  // Indicates how traffic is distributed among the load balancer Availability Zones.
  clientRoutingPolicy: elbv2.ClientRoutingPolicy.AVAILABILITY_ZONE_AFFINITY,

  // Indicates whether zonal shift is enabled.
  zonalShift: true,
});
python
# vpc: ec2.Vpc


lb = elbv2.NetworkLoadBalancer(self, "LB",
    vpc=vpc,
    # Whether deletion protection is enabled.
    deletion_protection=True,

    # Whether cross-zone load balancing is enabled.
    cross_zone_enabled=True,

    # Whether the load balancer blocks traffic through the Internet Gateway (IGW).
    deny_all_igw_traffic=False,

    # Indicates how traffic is distributed among the load balancer Availability Zones.
    client_routing_policy=elbv2.ClientRoutingPolicy.AVAILABILITY_ZONE_AFFINITY,

    # Indicates whether zonal shift is enabled.
    zonal_shift=True
)
java
Vpc vpc;


NetworkLoadBalancer lb = NetworkLoadBalancer.Builder.create(this, "LB")
        .vpc(vpc)
        // Whether deletion protection is enabled.
        .deletionProtection(true)

        // Whether cross-zone load balancing is enabled.
        .crossZoneEnabled(true)

        // Whether the load balancer blocks traffic through the Internet Gateway (IGW).
        .denyAllIgwTraffic(false)

        // Indicates how traffic is distributed among the load balancer Availability Zones.
        .clientRoutingPolicy(ClientRoutingPolicy.AVAILABILITY_ZONE_AFFINITY)

        // Indicates whether zonal shift is enabled.
        .zonalShift(true)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Vpc vpc;


var lb = new NetworkLoadBalancer(this, "LB", new NetworkLoadBalancerProps {
    Vpc = vpc,
    // Whether deletion protection is enabled.
    DeletionProtection = true,

    // Whether cross-zone load balancing is enabled.
    CrossZoneEnabled = true,

    // Whether the load balancer blocks traffic through the Internet Gateway (IGW).
    DenyAllIgwTraffic = false,

    // Indicates how traffic is distributed among the load balancer Availability Zones.
    ClientRoutingPolicy = ClientRoutingPolicy.AVAILABILITY_ZONE_AFFINITY,

    // Indicates whether zonal shift is enabled.
    ZonalShift = true
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var vpc Vpc


lb := elbv2.NewNetworkLoadBalancer(this, jsii.String("LB"), &NetworkLoadBalancerProps{
	Vpc: Vpc,
	// Whether deletion protection is enabled.
	DeletionProtection: jsii.Boolean(true),

	// Whether cross-zone load balancing is enabled.
	CrossZoneEnabled: jsii.Boolean(true),

	// Whether the load balancer blocks traffic through the Internet Gateway (IGW).
	DenyAllIgwTraffic: jsii.Boolean(false),

	// Indicates how traffic is distributed among the load balancer Availability Zones.
	ClientRoutingPolicy: elbv2.ClientRoutingPolicy_AVAILABILITY_ZONE_AFFINITY,

	// Indicates whether zonal shift is enabled.
	ZonalShift: jsii.Boolean(true),
})

Members ​

MemberDescription
AVAILABILITY_ZONE_AFFINITY100 percent zonal affinity.
PARTIAL_AVAILABILITY_ZONE_AFFINITY85 percent zonal affinity.
ANY_AVAILABILITY_ZONENo zonal affinity.

Referenced by ​

  • NetworkLoadBalancerProps.clientRoutingPolicyclient_routing_policyclientRoutingPolicyClientRoutingPolicyClientRoutingPolicy