aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancerProps

interface ApplicationLoadBalancerProps

LanguageType name
.NETAmazon.CDK.AWS.ElasticLoadBalancingV2.ApplicationLoadBalancerProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awselasticloadbalancingv2#ApplicationLoadBalancerProps
Javasoftware.amazon.awscdk.services.elasticloadbalancingv2.ApplicationLoadBalancerProps
Pythonaws_cdk.aws_elasticloadbalancingv2.ApplicationLoadBalancerProps
TypeScript (source)aws-cdk-lib » aws_elasticloadbalancingv2 » ApplicationLoadBalancerProps

Properties for defining an Application Load Balancer.

Example

declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
declare const vpc: ec2.Vpc;
const service = new ecs.FargateService(this, 'Service', { cluster, taskDefinition });

const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { vpc, internetFacing: true });
const listener = lb.addListener('Listener', { port: 80 });
service.registerLoadBalancerTargets(
  {
    containerName: 'web',
    containerPort: 80,
    newTargetGroupId: 'ECS',
    listener: ecs.ListenerConfig.applicationListener(listener, {
      protocol: elbv2.ApplicationProtocol.HTTPS
    }),
  },
);

Properties

NameTypeDescription
vpcIVpcThe VPC network to place the load balancer in.
deletionProtection?booleanIndicates whether deletion protection is enabled.
desyncMitigationMode?DesyncMitigationModeDetermines how the load balancer handles requests that might pose a security risk to your application.
dropInvalidHeaderFields?booleanIndicates whether HTTP headers with invalid header fields are removed by the load balancer (true) or routed to targets (false).
http2Enabled?booleanIndicates whether HTTP/2 is enabled.
idleTimeout?DurationThe load balancer idle timeout, in seconds.
internetFacing?booleanWhether the load balancer has an internet-routable address.
ipAddressType?IpAddressTypeThe type of IP addresses to use.
loadBalancerName?stringName of the load balancer.
securityGroup?ISecurityGroupSecurity group to associate with this load balancer.
vpcSubnets?SubnetSelectionWhich subnets place the load balancer in.

vpc

Type: IVpc

The VPC network to place the load balancer in.


deletionProtection?

Type: boolean (optional, default: false)

Indicates whether deletion protection is enabled.


desyncMitigationMode?

Type: DesyncMitigationMode (optional, default: DesyncMitigationMode.DEFENSIVE)

Determines how the load balancer handles requests that might pose a security risk to your application.


dropInvalidHeaderFields?

Type: boolean (optional, default: false)

Indicates whether HTTP headers with invalid header fields are removed by the load balancer (true) or routed to targets (false).


http2Enabled?

Type: boolean (optional, default: true)

Indicates whether HTTP/2 is enabled.


idleTimeout?

Type: Duration (optional, default: 60)

The load balancer idle timeout, in seconds.


internetFacing?

Type: boolean (optional, default: false)

Whether the load balancer has an internet-routable address.


ipAddressType?

Type: IpAddressType (optional, default: IpAddressType.Ipv4)

The type of IP addresses to use.

Only applies to application load balancers.


loadBalancerName?

Type: string (optional, default: Automatically generated name.)

Name of the load balancer.


securityGroup?

Type: ISecurityGroup (optional, default: A security group is created)

Security group to associate with this load balancer.


vpcSubnets?

Type: SubnetSelection (optional, default: the Vpc default strategy.)

Which subnets place the load balancer in.