Table of Contents

Interface ILoadBalancerProps

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

Construction properties for a LoadBalancer.

public interface ILoadBalancerProps

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

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.

CfnLoadBalancer.IAccessLoggingPolicyProperty? AccessLoggingPolicy { get; }

Property Value

CfnLoadBalancer.IAccessLoggingPolicyProperty

Remarks

Default: - disabled

CrossZone

Whether cross zone load balancing is enabled.

bool? CrossZone { get; }

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.

IHealthCheck? HealthCheck { get; }

Property Value

IHealthCheck

Remarks

Not required but recommended.

Default: - None.

InternetFacing

Whether this is an internet-facing Load Balancer.

bool? InternetFacing { get; }

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.

ILoadBalancerListener[]? Listeners { get; }

Property Value

ILoadBalancerListener[]

Remarks

Can also be added by .addListener()

Default: -

SubnetSelection

Which subnets to deploy the load balancer.

ISubnetSelection? SubnetSelection { get; }

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.

ILoadBalancerTarget[]? Targets { get; }

Property Value

ILoadBalancerTarget[]

Remarks

Can also be added by .addTarget()

Default: - None.

Vpc

VPC network of the fleet instances.

IVpc Vpc { get; }

Property Value

IVpc