Skip to main content

The CDK Construct Library for AWS::ElasticLoadBalancing

Project description

Amazon Elastic Load Balancing Construct Library

---

cfn-resources: Stable

cdk-constructs: Stable


The @aws-cdk/aws-elasticloadbalancing package provides constructs for configuring classic load balancers.

Configuring a Load Balancer

Load balancers send traffic to one or more AutoScalingGroups. Create a load balancer, set up listeners and a health check, and supply the fleet(s) you want to load balance to in the targets property.

# vpc: ec2.IVpc

# my_auto_scaling_group: autoscaling.AutoScalingGroup

lb = elb.LoadBalancer(self, "LB",
    vpc=vpc,
    internet_facing=True,
    health_check=elb.HealthCheck(
        port=80
    )
)
lb.add_target(my_auto_scaling_group)
lb.add_listener(
    external_port=80
)

The load balancer allows all connections by default. If you want to change that, pass the allowConnectionsFrom property while setting up the listener:

# my_security_group: ec2.SecurityGroup
# lb: elb.LoadBalancer

lb.add_listener(
    external_port=80,
    allow_connections_from=[my_security_group]
)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws-cdk.aws-elasticloadbalancing-1.166.1.tar.gz (104.1 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file aws-cdk.aws-elasticloadbalancing-1.166.1.tar.gz.

File metadata

File hashes

Hashes for aws-cdk.aws-elasticloadbalancing-1.166.1.tar.gz
Algorithm Hash digest
SHA256 fbb4e73f2684c572a0f5d4ed1a5a3dc261e2bcb2ecda64ed149a323a9b8c3c52
MD5 4f55e9d1da9130eaea522b2e80763298
BLAKE2b-256 1f0e0d7f0c829ea8722c3df8a4d85c13e40b91bad9400e4bf26975a4fa0eab14

See more details on using hashes here.

File details

Details for the file aws_cdk.aws_elasticloadbalancing-1.166.1-py3-none-any.whl.

File metadata

File hashes

Hashes for aws_cdk.aws_elasticloadbalancing-1.166.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9eacb7e68333d09d43c3042f29a1671a38d450232d8f40fda6a22c4b356f1769
MD5 b1b2a17232b5be5c1511b324fb513c81
BLAKE2b-256 d5ca4a7d022923e441d58874d4545a4a7419045d74e4efeaf628258c1d432eba

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page