ApplicationLoadBalancerProps
- class aws_cdk.aws_elasticloadbalancingv2.ApplicationLoadBalancerProps(*, vpc, deletion_protection=None, internet_facing=None, load_balancer_name=None, vpc_subnets=None, desync_mitigation_mode=None, drop_invalid_header_fields=None, http2_enabled=None, idle_timeout=None, ip_address_type=None, security_group=None)
Bases:
BaseLoadBalancerProps
Properties for defining an Application Load Balancer.
- Parameters:
vpc (
IVpc
) – The VPC network to place the load balancer in.deletion_protection (
Optional
[bool
]) – Indicates whether deletion protection is enabled. Default: falseinternet_facing (
Optional
[bool
]) – Whether the load balancer has an internet-routable address. Default: falseload_balancer_name (
Optional
[str
]) – Name of the load balancer. Default: - Automatically generated name.vpc_subnets (
Union
[SubnetSelection
,Dict
[str
,Any
],None
]) – Which subnets place the load balancer in. Default: - the Vpc default strategy.desync_mitigation_mode (
Optional
[DesyncMitigationMode
]) – Determines how the load balancer handles requests that might pose a security risk to your application. Default: DesyncMitigationMode.DEFENSIVEdrop_invalid_header_fields (
Optional
[bool
]) – Indicates whether HTTP headers with invalid header fields are removed by the load balancer (true) or routed to targets (false). Default: falsehttp2_enabled (
Optional
[bool
]) – Indicates whether HTTP/2 is enabled. Default: trueidle_timeout (
Optional
[Duration
]) – The load balancer idle timeout, in seconds. Default: 60ip_address_type (
Optional
[IpAddressType
]) – The type of IP addresses to use. Only applies to application load balancers. Default: IpAddressType.Ipv4security_group (
Optional
[ISecurityGroup
]) – Security group to associate with this load balancer. Default: A security group is created
- ExampleMetadata:
infused
Example:
from aws_cdk.aws_autoscaling import AutoScalingGroup # asg: AutoScalingGroup # vpc: ec2.Vpc # Create the load balancer in a VPC. 'internetFacing' is 'false' # by default, which creates an internal load balancer. lb = elbv2.ApplicationLoadBalancer(self, "LB", vpc=vpc, internet_facing=True ) # Add a listener and open up the load balancer's security group # to the world. listener = lb.add_listener("Listener", port=80, # 'open: true' is the default, you can leave it out if you want. Set it # to 'false' and use `listener.connections` if you want to be selective # about who can access the load balancer. open=True ) # Create an AutoScaling group and add it as a load balancing # target to the listener. listener.add_targets("ApplicationFleet", port=8080, targets=[asg] )
Attributes
- deletion_protection
Indicates whether deletion protection is enabled.
- Default:
false
- desync_mitigation_mode
Determines how the load balancer handles requests that might pose a security risk to your application.
- Default:
DesyncMitigationMode.DEFENSIVE
- drop_invalid_header_fields
Indicates whether HTTP headers with invalid header fields are removed by the load balancer (true) or routed to targets (false).
- Default:
false
- http2_enabled
Indicates whether HTTP/2 is enabled.
- Default:
true
- idle_timeout
The load balancer idle timeout, in seconds.
- Default:
60
- internet_facing
Whether the load balancer has an internet-routable address.
- Default:
false
- ip_address_type
The type of IP addresses to use.
Only applies to application load balancers.
- Default:
IpAddressType.Ipv4
- load_balancer_name
Name of the load balancer.
- Default:
Automatically generated name.
- security_group
Security group to associate with this load balancer.
- Default:
A security group is created
- vpc
The VPC network to place the load balancer in.
- vpc_subnets
Which subnets place the load balancer in.
- Default:
the Vpc default strategy.