interface LoadBalancerProps
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ElasticLoadBalancing.LoadBalancerProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awselasticloadbalancing#LoadBalancerProps |
Java | software.amazon.awscdk.services.elasticloadbalancing.LoadBalancerProps |
Python | aws_cdk.aws_elasticloadbalancing.LoadBalancerProps |
TypeScript (source) | aws-cdk-lib » aws_elasticloadbalancing » LoadBalancerProps |
Construction properties for a LoadBalancer.
Example
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
declare const vpc: ec2.Vpc;
const service = new ecs.Ec2Service(this, 'Service', { cluster, taskDefinition, minHealthyPercent: 100 });
const lb = new elb.LoadBalancer(this, 'LB', { vpc });
lb.addListener({ externalPort: 80 });
lb.addTarget(service);
Properties
| Name | Type | Description |
|---|---|---|
| vpc | IVpc | VPC network of the fleet instances. |
| access | Access | 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. |
| cross | boolean | Whether cross zone load balancing is enabled. |
| health | Health | Health check settings for the load balancing targets. |
| internet | boolean | Whether this is an internet-facing Load Balancer. |
| listeners? | Load[] | What listeners to set up for the load balancer. |
| subnet | Subnet | Which subnets to deploy the load balancer. |
| targets? | ILoad[] | What targets to load balance to. |
vpc
Type:
IVpc
VPC network of the fleet instances.
accessLoggingPolicy?
Type:
Access
(optional, default: disabled)
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.
crossZone?
Type:
boolean
(optional, default: true)
Whether cross zone load balancing is enabled.
This controls whether the load balancer evenly distributes requests across each availability zone
healthCheck?
Type:
Health
(optional, default: None.)
Health check settings for the load balancing targets.
Not required but recommended.
internetFacing?
Type:
boolean
(optional, default: false)
Whether this is an internet-facing Load Balancer.
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.
listeners?
Type:
Load[]
(optional, default: -)
What listeners to set up for the load balancer.
Can also be added by .addListener()
subnetSelection?
Type:
Subnet
(optional, default: Public subnets if internetFacing, Private subnets otherwise)
Which subnets to deploy the load balancer.
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.
targets?
Type:
ILoad[]
(optional, default: None.)
What targets to load balance to.
Can also be added by .addTarget()

.NET
Go
Java
Python
TypeScript (