Skip to content
v2.275.0

BaseLoadBalancer L2 construct ​

Base class for both Application and Network Load Balancers.

Initializer ​

ts
new BaseLoadBalancer(scope: Construct, id: string, baseProps: BaseLoadBalancerProps, additionalProps: any)
python
BaseLoadBalancer(scope: Construct, id: str, base_props: BaseLoadBalancerProps, additional_props: Any)
java
new BaseLoadBalancer(Construct scope, String id, BaseLoadBalancerProps baseProps, Object additionalProps)
csharp
new BaseLoadBalancer(Construct scope, string id, BaseLoadBalancerProps baseProps, object additionalProps)
go
NewBaseLoadBalancer(Scope Construct, Id *string, BaseProps BaseLoadBalancerProps, AdditionalProps interface{})

Construct Props ​

crossZoneEnabledoptionalbooleancross_zone_enabledoptionalboolcrossZoneEnabledoptionalBooleanCrossZoneEnabledoptionalboolCrossZoneEnabledoptional*bool#
Indicates whether cross-zone load balancing is enabled.

Default: false for Network Load Balancers and true for Application Load Balancers. This can not be false for Application Load Balancers.

deletionProtectionoptionalbooleandeletion_protectionoptionalbooldeletionProtectionoptionalBooleanDeletionProtectionoptionalboolDeletionProtectionoptional*bool= false#
Indicates whether deletion protection is enabled.
denyAllIgwTrafficoptionalbooleandeny_all_igw_trafficoptionalbooldenyAllIgwTrafficoptionalBooleanDenyAllIgwTrafficoptionalboolDenyAllIgwTrafficoptional*bool#
Indicates whether the load balancer blocks traffic through the Internet Gateway (IGW).

Default: false for internet-facing load balancers and true for internal load balancers

internetFacingoptionalbooleaninternet_facingoptionalboolinternetFacingoptionalBooleanInternetFacingoptionalboolInternetFacingoptional*bool= false#
Whether the load balancer has an internet-routable address.
loadBalancerNameoptionalstringload_balancer_nameoptionalstrloadBalancerNameoptionalStringLoadBalancerNameoptionalstringLoadBalancerNameoptional*string#
Name of the load balancer.

Default: Automatically generated name.

minimumCapacityUnitoptionalnumberminimum_capacity_unitoptionalint | floatminimumCapacityUnitoptionalNumberMinimumCapacityUnitoptionaldoubleMinimumCapacityUnitoptional*float64#
The minimum capacity (LCU) for a load balancer.

Default: undefined - ELB default is 0 LCU

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpcrequired#
The VPC network to place the load balancer in.
vpcSubnetsoptionalSubnetSelectionvpc_subnetsoptionalSubnetSelectionvpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelection#
Which subnets place the load balancer in.

Default: the Vpc default strategy.

Properties ​

The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

loadBalancerArnstringload_balancer_arnstrloadBalancerArnStringLoadBalancerArnstringLoadBalancerArn*string#
The ARN of this load balancer.

Example value: arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-internal-load-balancer/50dc6c495c0c9188

loadBalancerCanonicalHostedZoneIdstringload_balancer_canonical_hosted_zone_idstrloadBalancerCanonicalHostedZoneIdStringLoadBalancerCanonicalHostedZoneIdstringLoadBalancerCanonicalHostedZoneId*string#
The canonical hosted zone ID of this load balancer.

Example value: Z2P70J7EXAMPLE

loadBalancerDnsNamestringload_balancer_dns_namestrloadBalancerDnsNameStringLoadBalancerDnsNamestringLoadBalancerDnsName*string#
The DNS name of this load balancer.

Example value: my-load-balancer-424835706.us-west-2.elb.amazonaws.com

loadBalancerFullNamestringload_balancer_full_namestrloadBalancerFullNameStringLoadBalancerFullNamestringLoadBalancerFullName*string#
The full name of this load balancer.

Example value: app/my-load-balancer/50dc6c495c0c9188

loadBalancerNamestringload_balancer_namestrloadBalancerNameStringLoadBalancerNamestringLoadBalancerName*string#
The name of this load balancer.

Example value: my-load-balancer

loadBalancerRefLoadBalancerReferenceload_balancer_refLoadBalancerReferenceloadBalancerRefLoadBalancerReferenceLoadBalancerRefLoadBalancerReferenceLoadBalancerRefLoadBalancerReference#
A reference to this load balancer.
loadBalancerSecurityGroupsstring[]load_balancer_security_groupstyping.List[str]loadBalancerSecurityGroupsList<String>LoadBalancerSecurityGroupsstring[]LoadBalancerSecurityGroups*[]*string#
nodeNodenodeNodenodeNodeNodeNodeNodeNode#
The tree node.
stackStackstackStackstackStackStackStackStackStack#
The stack in which this resource is defined.
vpcmay be undefinedIVpcvpcmay be undefinedIVpcvpcmay be undefinedIVpcVpcmay be undefinedIVpcVpcmay be undefinedIVpc#
The VPC this load balancer has been created in.

This property is always defined (not null or undefined) for sub-classes of BaseLoadBalancer.

Methods ​

applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
logAccessLogs(bucket: IBucket, prefix?: string): voiddef log_access_logs(self, bucket: IBucket, prefix: typing.Optional[str] = None) -> Nonepublic void logAccessLogs(IBucket bucket, String prefix)public void LogAccessLogs(IBucket bucket, string? prefix = null)func LogAccessLogs(Bucket IBucket, Prefix *string)#
Enable access logging for this load balancer.

A region must be specified on the stack containing the load balancer; you cannot enable logging on environment-agnostic stacks. See https://docs.aws.amazon.com/cdk/latest/guide/environments.html

removeAttribute(key: string): voiddef remove_attribute(self, key: str) -> Nonepublic void removeAttribute(String key)public void RemoveAttribute(string key)func RemoveAttribute(Key *string)#
Remove an attribute from the load balancer.
setAttribute(key: string, value?: string): voiddef set_attribute(self, key: str, value: typing.Optional[str] = None) -> Nonepublic void setAttribute(String key, String value)public void SetAttribute(string key, string? value = null)func SetAttribute(Key *string, Value *string)#
Set a non-standard attribute on the load balancer.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.