ApplicationLoadBalancerProps

class aws_cdk.aws_elasticloadbalancingv2.ApplicationLoadBalancerProps(*, vpc, deletion_protection=None, internet_facing=None, load_balancer_name=None, vpc_subnets=None, http2_enabled=None, idle_timeout=None, ip_address_type=None, security_group=None)

Bases: aws_cdk.aws_elasticloadbalancingv2.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: false

  • internet_facing (Optional[bool]) – Whether the load balancer has an internet-routable address. Default: false

  • load_balancer_name (Optional[str]) – Name of the load balancer. Default: - Automatically generated name.

  • vpc_subnets (Optional[SubnetSelection]) – Which subnets place the load balancer in. Default: - the Vpc default strategy.

  • http2_enabled (Optional[bool]) – Indicates whether HTTP/2 is enabled. Default: true

  • idle_timeout (Optional[Duration]) – The load balancer idle timeout, in seconds. Default: 60

  • ip_address_type (Optional[IpAddressType]) – The type of IP addresses to use. Only applies to application load balancers. Default: IpAddressType.Ipv4

  • security_group (Optional[ISecurityGroup]) – Security group to associate with this load balancer. Default: A security group is created

ExampleMetadata

infused

Example:

# cluster: ecs.Cluster
# task_definition: ecs.TaskDefinition
# vpc: ec2.Vpc

service = ecs.FargateService(self, "Service", cluster=cluster, task_definition=task_definition)

lb = elbv2.ApplicationLoadBalancer(self, "LB", vpc=vpc, internet_facing=True)
listener = lb.add_listener("Listener", port=80)
service.register_load_balancer_targets(
    container_name="web",
    container_port=80,
    new_target_group_id="ECS",
    listener=ecs.ListenerConfig.application_listener(listener,
        protocol=elbv2.ApplicationProtocol.HTTPS
    )
)

Attributes

deletion_protection

Indicates whether deletion protection is enabled.

Default

false

Return type

Optional[bool]

http2_enabled

Indicates whether HTTP/2 is enabled.

Default

true

Return type

Optional[bool]

idle_timeout

The load balancer idle timeout, in seconds.

Default

60

Return type

Optional[Duration]

internet_facing

Whether the load balancer has an internet-routable address.

Default

false

Return type

Optional[bool]

ip_address_type

The type of IP addresses to use.

Only applies to application load balancers.

Default

IpAddressType.Ipv4

Return type

Optional[IpAddressType]

load_balancer_name

Name of the load balancer.

Default
  • Automatically generated name.

Return type

Optional[str]

security_group

Security group to associate with this load balancer.

Default

A security group is created

Return type

Optional[ISecurityGroup]

vpc

The VPC network to place the load balancer in.

Return type

IVpc

vpc_subnets

Which subnets place the load balancer in.

Default
  • the Vpc default strategy.

Return type

Optional[SubnetSelection]