A load balancer with a single listener. Routes to a fleet of instances in a VPC.
import { LoadBalancer } from 'aws-cdk-lib/aws-elasticloadbalancing';Or use the module namespace:
import * as elasticloadbalancing from 'aws-cdk-lib/aws-elasticloadbalancing';
// elasticloadbalancing.LoadBalancerConfiguration passed to the constructor as LoadBalancerProps.
vpcRequiredIVpcVPC network of the fleet instances.
accessLoggingPolicyOptionalAccessLoggingPolicyPropertyEnable Loadbalancer access logs Can be used to avoid manual work as aws console Required S3 bucket name , enabled flag Can add interval for pushing log Can set bucket prefix in order to provide folder name inside bucket.
Default: - disabled
crossZoneOptionalbooleanWhether cross zone load balancing is enabled. This controls whether the load balancer evenly distributes requests across each availability zone
Default: true
healthCheckOptionalHealthCheckHealth check settings for the load balancing targets. Not required but recommended.
Default: - None.
internetFacingOptionalbooleanWhether this is an internet-facing Load Balancer. This controls whether the LB has a public IP address assigned. It does not open up the Load Balancer's security groups to public internet access.
Default: false
listenersOptionalLoadBalancerListener[]What listeners to set up for the load balancer. Can also be added by .addListener()
Default: -
subnetSelectionOptionalSubnetSelectionWhich subnets to deploy the load balancer. Can be used to define a specific set of subnets to deploy the load balancer to. Useful multiple public or private subnets are covering the same availability zone.
Default: - Public subnets if internetFacing, Private subnets otherwise
targetsOptionalILoadBalancerTarget[]What targets to load balance to. Can also be added by .addTarget()
Default: - None.
Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.
Subscribe to Newsletteraws-elasticloadbalancing