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.200.0.tar.gz (109.3 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for aws-cdk.aws-elasticloadbalancing-1.200.0.tar.gz
Algorithm Hash digest
SHA256 9d657dd02bb6aa2cdf7d1908ef0708d82ef5782a4ed004bc57b0e00f6898746f
MD5 95bbed83b1be6dee5486cc58600abd98
BLAKE2b-256 3f3c6aa86970a8b5942f81e77a6be55e1bcf709105f5e1693f3f3acb04ea5388

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aws_cdk.aws_elasticloadbalancing-1.200.0-py3-none-any.whl
Algorithm Hash digest
SHA256 563554f92c7df4c0a0440fe68a25f47dfc46e9f8c2c299a383ca5aa70ea5b866
MD5 c51379b19e107c80e1bc00310e0f1641
BLAKE2b-256 6e37388ef0e3b5ed10e6f352894d52fa8d0a261571416c0f77536fdf96565ba0

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