# LoadBalancerProps

Construction properties for a LoadBalancer.

Extends: LoadBalancerProps
Used as props by: LoadBalancer

- Source: [`aws-elasticloadbalancing/lib/load-balancer.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-elasticloadbalancing/lib/load-balancer.ts#L28)

## Example

```ts
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

- `accessLoggingPolicy`: [CfnLoadBalancer.AccessLoggingPolicyProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancing.CfnLoadBalancer.AccessLoggingPolicyProperty.html) = 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`: boolean = true — Whether cross zone load balancing is enabled.

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

- `healthCheck`: [HealthCheck](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancing.HealthCheck.html) = None. — Health check settings for the load balancing targets.

  Not required but recommended.

- `internetFacing`: boolean = 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`: [LoadBalancerListener](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancing.LoadBalancerListener.html)[] — What listeners to set up for the load balancer.

  Can also be added by .addListener()

- `subnetSelection`: [SubnetSelection](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetSelection.html) — Which subnets to deploy the load balancer.

  **Default:** Public subnets if internetFacing, Private subnets otherwise

  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`: [ILoadBalancerTarget](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancing.ILoadBalancerTarget.html)[] = None. — What targets to load balance to.

  Can also be added by .addTarget()

- `vpc`: [IVpc](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) (required) — VPC network of the fleet instances.
