aws-cdk-lib.aws_elasticloadbalancingv2.BaseLoadBalancer

class BaseLoadBalancer

LanguageType name
.NETAmazon.CDK.AWS.ElasticLoadBalancingV2.BaseLoadBalancer
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awselasticloadbalancingv2#BaseLoadBalancer
Javasoftware.amazon.awscdk.services.elasticloadbalancingv2.BaseLoadBalancer
Pythonaws_cdk.aws_elasticloadbalancingv2.BaseLoadBalancer
TypeScript (source)aws-cdk-lib » aws_elasticloadbalancingv2 » BaseLoadBalancer

Implements IConstruct, IDependable, IResource

Extends Resource

Implemented by ApplicationLoadBalancer, NetworkLoadBalancer

Base class for both Application and Network Load Balancers.

Initializer

new BaseLoadBalancer(scope: Construct, id: string, baseProps: BaseLoadBalancerProps, additionalProps: any)

Parameters

  • scope Construct
  • id string
  • baseProps BaseLoadBalancerProps
  • additionalProps any

Properties

NameTypeDescription
envResourceEnvironmentThe environment this resource belongs to.
loadBalancerArnstringThe ARN of this load balancer.
loadBalancerCanonicalHostedZoneIdstringThe canonical hosted zone ID of this load balancer.
loadBalancerDnsNamestringThe DNS name of this load balancer.
loadBalancerFullNamestringThe full name of this load balancer.
loadBalancerNamestringThe name of this load balancer.
loadBalancerSecurityGroupsstring[]
nodeNodeThe tree node.
stackStackThe stack in which this resource is defined.
vpc?IVpcThe VPC this load balancer has been created in.

env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


loadBalancerArn

Type: string

The ARN of this load balancer.

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


loadBalancerCanonicalHostedZoneId

Type: string

The canonical hosted zone ID of this load balancer.

Example value: Z2P70J7EXAMPLE


loadBalancerDnsName

Type: string

The DNS name of this load balancer.

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


loadBalancerFullName

Type: string

The full name of this load balancer.

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


loadBalancerName

Type: string

The name of this load balancer.

Example value: my-load-balancer


loadBalancerSecurityGroups

Type: string[]


node

Type: Node

The tree node.


stack

Type: Stack

The stack in which this resource is defined.


vpc?

Type: IVpc (optional)

The VPC this load balancer has been created in.

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

Methods

NameDescription
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
logAccessLogs(bucket, prefix?)Enable access logging for this load balancer.
removeAttribute(key)Remove an attribute from the load balancer.
setAttribute(key, value?)Set a non-standard attribute on the load balancer.
toString()Returns a string representation of this construct.
protected resourcePolicyPrincipal()
protected validateLoadBalancer()

applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

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).


logAccessLogs(bucket, prefix?)

public logAccessLogs(bucket: IBucket, prefix?: string): void

Parameters

  • 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)

public removeAttribute(key: string): void

Parameters

  • key string

Remove an attribute from the load balancer.


setAttribute(key, value?)

public setAttribute(key: string, value?: string): void

Parameters

  • key string
  • value string

Set a non-standard attribute on the load balancer.

See also: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#load-balancer-attributes


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.


protected resourcePolicyPrincipal()

protected resourcePolicyPrincipal(): IPrincipal

Returns

  • IPrincipal

protected validateLoadBalancer()

protected validateLoadBalancer(): string[]

Returns

  • string[]