Table of Contents

Class LoadBalancerProps

Namespace
Amazon.CDK.AWS.ElasticLoadBalancing
Assembly
Amazon.CDK.AWS.ElasticLoadBalancing.dll

Construction properties for a LoadBalancer.

public class LoadBalancerProps : ILoadBalancerProps
Inheritance
LoadBalancerProps
Implements
Inherited Members

Examples

Cluster cluster;
            TaskDefinition taskDefinition;
            Vpc vpc;

            var service = new Ec2Service(this, "Service", new Ec2ServiceProps { Cluster = cluster, TaskDefinition = taskDefinition });

            var lb = new LoadBalancer(this, "LB", new LoadBalancerProps { Vpc = vpc });
            lb.AddListener(new LoadBalancerListener { ExternalPort = 80 });
            lb.AddTarget(service);

Remarks

ExampleMetadata: infused

Constructors

LoadBalancerProps()

public LoadBalancerProps()

Properties

AccessLoggingPolicy

Enable Loadbalancer access logs Can be used to avoid manual work as aws console Required S3 bucket name , enabled flag Can add interval for pushing log Can set bucket prefix in order to provide folder name inside bucket.

public CfnLoadBalancer.IAccessLoggingPolicyProperty? AccessLoggingPolicy { get; set; }

Property Value

CfnLoadBalancer.IAccessLoggingPolicyProperty

Remarks

Default: - disabled

CrossZone

Whether cross zone load balancing is enabled.

public bool? CrossZone { get; set; }

Property Value

bool?

Remarks

This controls whether the load balancer evenly distributes requests across each availability zone

Default: true

HealthCheck

Health check settings for the load balancing targets.

public IHealthCheck? HealthCheck { get; set; }

Property Value

IHealthCheck

Remarks

Not required but recommended.

Default: - None.

InternetFacing

Whether this is an internet-facing Load Balancer.

public bool? InternetFacing { get; set; }

Property Value

bool?

Remarks

This controls whether the LB has a public IP address assigned. It does not open up the Load Balancer's security groups to public internet access.

Default: false

Listeners

What listeners to set up for the load balancer.

public ILoadBalancerListener[]? Listeners { get; set; }

Property Value

ILoadBalancerListener[]

Remarks

Can also be added by .addListener()

Default: -

SubnetSelection

Which subnets to deploy the load balancer.

public ISubnetSelection? SubnetSelection { get; set; }

Property Value

ISubnetSelection

Remarks

Can be used to define a specific set of subnets to deploy the load balancer to. Useful multiple public or private subnets are covering the same availability zone.

Default: - Public subnets if internetFacing, Private subnets otherwise

Targets

What targets to load balance to.

public ILoadBalancerTarget[]? Targets { get; set; }

Property Value

ILoadBalancerTarget[]

Remarks

Can also be added by .addTarget()

Default: - None.

Vpc

VPC network of the fleet instances.

public IVpc Vpc { get; set; }

Property Value

IVpc