This documentation is for the developer preview release of the AWS CDK. Do not use this version of the AWS CDK in production. Subsequent releases of the AWS CDK will likely include breaking changes.

@aws-cdk/aws-elasticloadbalancing

AWS Elastic Load Balancing Construct Library

The @aws-cdk/aws-ec2 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.

const lb = new elb.LoadBalancer(this, 'LB', {
    vpc,
    internetFacing: true,
    healthCheck: {
        port: 80
    },
});

lb.addTarget(myAutoScalingGroup);
lb.addListener({
    externalPort: 80,
});

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

lb.addListener({
    externalPort: 80,
    allowConnectionsFrom: [mySecurityGroup]
});

Reference

View in Nuget

csproj:

<PackageReference Include="Amazon.CDK.AWS.ElasticLoadBalancing" Version="0.25.3" />

dotnet:

dotnet add package Amazon.CDK.AWS.ElasticLoadBalancing --version 0.25.3

packages.config:

<package id="Amazon.CDK.AWS.ElasticLoadBalancing" version="0.25.3" />

View in Maven Central

Apache Buildr:

'software.amazon.awscdk:elasticloadbalancing:jar:0.25.3'

Apache Ivy:

<dependency groupId="software.amazon.awscdk" name="elasticloadbalancing" rev="0.25.3"/>

Apache Maven:

<dependency>
  <groupId>software.amazon.awscdk</groupId>
  <artifactId>elasticloadbalancing</artifactId>
  <version>0.25.3</version>
</dependency>

Gradle / Grails:

compile 'software.amazon.awscdk:elasticloadbalancing:0.25.3'

Groovy Grape:

@Grapes(
@Grab(group='software.amazon.awscdk', module='elasticloadbalancing', version='0.25.3')
)

View in NPM

npm:

$ npm i @aws-cdk/aws-elasticloadbalancing@0.25.3

package.json:

{
  "@aws-cdk/aws-elasticloadbalancing": "^0.25.3"
}

yarn:

$ yarn add @aws-cdk/aws-elasticloadbalancing@0.25.3

View in NPM

npm:

$ npm i @aws-cdk/aws-elasticloadbalancing@0.25.3

package.json:

{
  "@aws-cdk/aws-elasticloadbalancing": "^0.25.3"
}

yarn:

$ yarn add @aws-cdk/aws-elasticloadbalancing@0.25.3

CfnLoadBalancer

class @aws-cdk/aws-elasticloadbalancing.CfnLoadBalancer(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.CfnLoadBalancer;
const { CfnLoadBalancer } = require('@aws-cdk/aws-elasticloadbalancing');
import { CfnLoadBalancer } from '@aws-cdk/aws-elasticloadbalancing';
Extends:

@aws-cdk/cdk.Resource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.Resource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
loadBalancerCanonicalHostedZoneName
Type:string (readonly)
loadBalancerCanonicalHostedZoneNameId
Type:string (readonly)
loadBalancerDnsName
Type:string (readonly)
loadBalancerName
Type:string (readonly)
loadBalancerSourceSecurityGroupGroupName
Type:string (readonly)
loadBalancerSourceSecurityGroupOwnerAlias
Type:string (readonly)
propertyOverrides
Type:CfnLoadBalancerProps (readonly)
tags

The TagManager handles setting, removing and formatting tags

Tags should be managed either passing them as properties during

initiation or by calling methods on this object. If both techniques are

used only the tags from the TagManager will be used. Tag (aspect)

will use the manager.

Type:@aws-cdk/cdk.TagManager (readonly)
class AccessLoggingPolicyProperty

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.CfnLoadBalancer.AccessLoggingPolicyProperty;
// CfnLoadBalancer.AccessLoggingPolicyProperty is an interface
import { CfnLoadBalancer.AccessLoggingPolicyProperty } from '@aws-cdk/aws-elasticloadbalancing';
enabled

CfnLoadBalancer.AccessLoggingPolicyProperty.Enabled

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-accessloggingpolicy.html#cfn-elb-accessloggingpolicy-enabled

Type:boolean or @aws-cdk/cdk.Token
s3BucketName

CfnLoadBalancer.AccessLoggingPolicyProperty.S3BucketName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-accessloggingpolicy.html#cfn-elb-accessloggingpolicy-s3bucketname

Type:string
emitInterval

CfnLoadBalancer.AccessLoggingPolicyProperty.EmitInterval

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-accessloggingpolicy.html#cfn-elb-accessloggingpolicy-emitinterval

Type:number or @aws-cdk/cdk.Token (optional)
s3BucketPrefix

CfnLoadBalancer.AccessLoggingPolicyProperty.S3BucketPrefix

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-accessloggingpolicy.html#cfn-elb-accessloggingpolicy-s3bucketprefix

Type:string (optional)
class AppCookieStickinessPolicyProperty

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.CfnLoadBalancer.AppCookieStickinessPolicyProperty;
// CfnLoadBalancer.AppCookieStickinessPolicyProperty is an interface
import { CfnLoadBalancer.AppCookieStickinessPolicyProperty } from '@aws-cdk/aws-elasticloadbalancing';
cookieName

CfnLoadBalancer.AppCookieStickinessPolicyProperty.CookieName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-AppCookieStickinessPolicy.html#cfn-elb-appcookiestickinesspolicy-cookiename

Type:string
policyName

CfnLoadBalancer.AppCookieStickinessPolicyProperty.PolicyName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-AppCookieStickinessPolicy.html#cfn-elb-appcookiestickinesspolicy-policyname

Type:string
class ConnectionDrainingPolicyProperty

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.CfnLoadBalancer.ConnectionDrainingPolicyProperty;
// CfnLoadBalancer.ConnectionDrainingPolicyProperty is an interface
import { CfnLoadBalancer.ConnectionDrainingPolicyProperty } from '@aws-cdk/aws-elasticloadbalancing';
enabled

CfnLoadBalancer.ConnectionDrainingPolicyProperty.Enabled

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-connectiondrainingpolicy.html#cfn-elb-connectiondrainingpolicy-enabled

Type:boolean or @aws-cdk/cdk.Token
timeout

CfnLoadBalancer.ConnectionDrainingPolicyProperty.Timeout

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-connectiondrainingpolicy.html#cfn-elb-connectiondrainingpolicy-timeout

Type:number or @aws-cdk/cdk.Token (optional)
class ConnectionSettingsProperty

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.CfnLoadBalancer.ConnectionSettingsProperty;
// CfnLoadBalancer.ConnectionSettingsProperty is an interface
import { CfnLoadBalancer.ConnectionSettingsProperty } from '@aws-cdk/aws-elasticloadbalancing';
idleTimeout

CfnLoadBalancer.ConnectionSettingsProperty.IdleTimeout

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-connectionsettings.html#cfn-elb-connectionsettings-idletimeout

Type:number or @aws-cdk/cdk.Token
class HealthCheckProperty

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.CfnLoadBalancer.HealthCheckProperty;
// CfnLoadBalancer.HealthCheckProperty is an interface
import { CfnLoadBalancer.HealthCheckProperty } from '@aws-cdk/aws-elasticloadbalancing';
healthyThreshold

CfnLoadBalancer.HealthCheckProperty.HealthyThreshold

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-health-check.html#cfn-elb-healthcheck-healthythreshold

Type:string
interval

CfnLoadBalancer.HealthCheckProperty.Interval

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-health-check.html#cfn-elb-healthcheck-interval

Type:string
target

CfnLoadBalancer.HealthCheckProperty.Target

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-health-check.html#cfn-elb-healthcheck-target

Type:string
timeout

CfnLoadBalancer.HealthCheckProperty.Timeout

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-health-check.html#cfn-elb-healthcheck-timeout

Type:string
unhealthyThreshold

CfnLoadBalancer.HealthCheckProperty.UnhealthyThreshold

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-health-check.html#cfn-elb-healthcheck-unhealthythreshold

Type:string
class LBCookieStickinessPolicyProperty

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.CfnLoadBalancer.LBCookieStickinessPolicyProperty;
// CfnLoadBalancer.LBCookieStickinessPolicyProperty is an interface
import { CfnLoadBalancer.LBCookieStickinessPolicyProperty } from '@aws-cdk/aws-elasticloadbalancing';
cookieExpirationPeriod

CfnLoadBalancer.LBCookieStickinessPolicyProperty.CookieExpirationPeriod

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-LBCookieStickinessPolicy.html#cfn-elb-lbcookiestickinesspolicy-cookieexpirationperiod

Type:string (optional)
policyName

CfnLoadBalancer.LBCookieStickinessPolicyProperty.PolicyName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-LBCookieStickinessPolicy.html#cfn-elb-lbcookiestickinesspolicy-policyname

Type:string (optional)
class ListenersProperty

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.CfnLoadBalancer.ListenersProperty;
// CfnLoadBalancer.ListenersProperty is an interface
import { CfnLoadBalancer.ListenersProperty } from '@aws-cdk/aws-elasticloadbalancing';
instancePort

CfnLoadBalancer.ListenersProperty.InstancePort

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html#cfn-ec2-elb-listener-instanceport

Type:string
loadBalancerPort

CfnLoadBalancer.ListenersProperty.LoadBalancerPort

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html#cfn-ec2-elb-listener-loadbalancerport

Type:string
protocol

CfnLoadBalancer.ListenersProperty.Protocol

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html#cfn-ec2-elb-listener-protocol

Type:string
instanceProtocol

CfnLoadBalancer.ListenersProperty.InstanceProtocol

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html#cfn-ec2-elb-listener-instanceprotocol

Type:string (optional)
policyNames

CfnLoadBalancer.ListenersProperty.PolicyNames

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html#cfn-ec2-elb-listener-policynames

Type:@aws-cdk/cdk.Token or (string or @aws-cdk/cdk.Token)[] (optional)
sslCertificateId

CfnLoadBalancer.ListenersProperty.SSLCertificateId

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html#cfn-ec2-elb-listener-sslcertificateid

Type:string (optional)
class PoliciesProperty

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.CfnLoadBalancer.PoliciesProperty;
// CfnLoadBalancer.PoliciesProperty is an interface
import { CfnLoadBalancer.PoliciesProperty } from '@aws-cdk/aws-elasticloadbalancing';
attributes

CfnLoadBalancer.PoliciesProperty.Attributes

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-policy.html#cfn-ec2-elb-policy-attributes

Type:@aws-cdk/cdk.Token or (json or @aws-cdk/cdk.Token)[]
policyName

CfnLoadBalancer.PoliciesProperty.PolicyName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-policy.html#cfn-ec2-elb-policy-policyname

Type:string
policyType

CfnLoadBalancer.PoliciesProperty.PolicyType

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-policy.html#cfn-ec2-elb-policy-policytype

Type:string
instancePorts

CfnLoadBalancer.PoliciesProperty.InstancePorts

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-policy.html#cfn-ec2-elb-policy-instanceports

Type:@aws-cdk/cdk.Token or (string or @aws-cdk/cdk.Token)[] (optional)
loadBalancerPorts

CfnLoadBalancer.PoliciesProperty.LoadBalancerPorts

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-policy.html#cfn-ec2-elb-policy-loadbalancerports

Type:@aws-cdk/cdk.Token or (string or @aws-cdk/cdk.Token)[] (optional)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.Resource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.Resource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.Resource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.Resource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.Resource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
toCloudFormation() → json

Inherited from @aws-cdk/cdk.Resource

Emits CloudFormation for this resource.

Return type:json
options

Inherited from @aws-cdk/cdk.Resource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.ResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.Resource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.Resource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.Resource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

CfnLoadBalancerProps (interface)

class @aws-cdk/aws-elasticloadbalancing.CfnLoadBalancerProps

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.CfnLoadBalancerProps;
// CfnLoadBalancerProps is an interface
import { CfnLoadBalancerProps } from '@aws-cdk/aws-elasticloadbalancing';
listeners

AWS::ElasticLoadBalancing::LoadBalancer.Listeners

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-listeners

Type:@aws-cdk/cdk.Token or (ListenersProperty or @aws-cdk/cdk.Token)[]
accessLoggingPolicy

AWS::ElasticLoadBalancing::LoadBalancer.AccessLoggingPolicy

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-accessloggingpolicy

Type:@aws-cdk/cdk.Token or AccessLoggingPolicyProperty (optional)
appCookieStickinessPolicy

AWS::ElasticLoadBalancing::LoadBalancer.AppCookieStickinessPolicy

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-appcookiestickinesspolicy

Type:@aws-cdk/cdk.Token or (@aws-cdk/cdk.Token or AppCookieStickinessPolicyProperty)[] (optional)
availabilityZones

AWS::ElasticLoadBalancing::LoadBalancer.AvailabilityZones

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-availabilityzones

Type:@aws-cdk/cdk.Token or (string or @aws-cdk/cdk.Token)[] (optional)
connectionDrainingPolicy

AWS::ElasticLoadBalancing::LoadBalancer.ConnectionDrainingPolicy

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-connectiondrainingpolicy

Type:@aws-cdk/cdk.Token or ConnectionDrainingPolicyProperty (optional)
connectionSettings

AWS::ElasticLoadBalancing::LoadBalancer.ConnectionSettings

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-connectionsettings

Type:@aws-cdk/cdk.Token or ConnectionSettingsProperty (optional)
crossZone

AWS::ElasticLoadBalancing::LoadBalancer.CrossZone

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-crosszone

Type:boolean or @aws-cdk/cdk.Token (optional)
healthCheck

AWS::ElasticLoadBalancing::LoadBalancer.HealthCheck

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-healthcheck

Type:@aws-cdk/cdk.Token or HealthCheckProperty (optional)
instances

AWS::ElasticLoadBalancing::LoadBalancer.Instances

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-instances

Type:@aws-cdk/cdk.Token or (string or @aws-cdk/cdk.Token)[] (optional)
lbCookieStickinessPolicy

AWS::ElasticLoadBalancing::LoadBalancer.LBCookieStickinessPolicy

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-lbcookiestickinesspolicy

Type:@aws-cdk/cdk.Token or (@aws-cdk/cdk.Token or LBCookieStickinessPolicyProperty)[] (optional)
loadBalancerName

AWS::ElasticLoadBalancing::LoadBalancer.LoadBalancerName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-elbname

Type:string (optional)
policies

AWS::ElasticLoadBalancing::LoadBalancer.Policies

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-policies

Type:@aws-cdk/cdk.Token or (@aws-cdk/cdk.Token or PoliciesProperty)[] (optional)
scheme

AWS::ElasticLoadBalancing::LoadBalancer.Scheme

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-scheme

Type:string (optional)
securityGroups

AWS::ElasticLoadBalancing::LoadBalancer.SecurityGroups

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-securitygroups

Type:@aws-cdk/cdk.Token or (string or @aws-cdk/cdk.Token)[] (optional)
subnets

AWS::ElasticLoadBalancing::LoadBalancer.Subnets

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-subnets

Type:@aws-cdk/cdk.Token or (string or @aws-cdk/cdk.Token)[] (optional)
tags

AWS::ElasticLoadBalancing::LoadBalancer.Tags

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-elasticloadbalancing-loadbalancer-tags

Type:@aws-cdk/cdk.Token or (@aws-cdk/cdk.Token or @aws-cdk/cdk.CfnTag)[] (optional)

HealthCheck (interface)

class @aws-cdk/aws-elasticloadbalancing.HealthCheck

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.HealthCheck;
// HealthCheck is an interface
import { HealthCheck } from '@aws-cdk/aws-elasticloadbalancing';

Describe the health check to a load balancer

port

What port number to health check on

Type:number
healthyThreshold

After how many successful checks is an instance considered healthy

Type:number (optional)
Default:2
interval

Number of seconds between health checks

Type:number (optional)
Default:30
path

What path to use for HTTP or HTTPS health check (must return 200)

For SSL and TCP health checks, accepting connections is enough to be considered

healthy.

Type:string (optional)
Default:“/”
protocol

What protocol to use for health checking

The protocol is automatically determined from the port if it’s not supplied.

Type:LoadBalancingProtocol (optional)
Default:Automatic
timeout

Health check timeout

Type:number (optional)
Default:5
unhealthyThreshold

After how many unsuccessful checks is an instance considered unhealthy

Type:number (optional)
Default:5

ILoadBalancerTarget (interface)

class @aws-cdk/aws-elasticloadbalancing.ILoadBalancerTarget

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.ILoadBalancerTarget;
// ILoadBalancerTarget is an interface
import { ILoadBalancerTarget } from '@aws-cdk/aws-elasticloadbalancing';

Interface that is going to be implemented by constructs that you can load balance to

Extends:@aws-cdk/aws-ec2.IConnectable
attachToClassicLB(loadBalancer)

Attach load-balanced target to a classic ELB

Parameters:loadBalancer (LoadBalancer) –
Abstract:Yes
connections

Inherited from @aws-cdk/aws-ec2.IConnectable

Type:@aws-cdk/aws-ec2.Connections (readonly)

ListenerPort

class @aws-cdk/aws-elasticloadbalancing.ListenerPort(securityGroup, defaultPortRange)

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.ListenerPort;
const { ListenerPort } = require('@aws-cdk/aws-elasticloadbalancing');
import { ListenerPort } from '@aws-cdk/aws-elasticloadbalancing';

Reference to a listener’s port just created.

This implements IConnectable with a default port (the port that an ELB

listener was just created on) for a given security group so that it can be

conveniently used just like any Connectable. E.g:

const listener = elb.addListener(…);

listener.connections.allowDefaultPortFromAnyIPv4();

// or

instance.connections.allowToDefaultPort(listener);

Implements:

@aws-cdk/aws-ec2.IConnectable

Parameters:
connections

Implements @aws-cdk/aws-ec2.IConnectable.connections()

Type:@aws-cdk/aws-ec2.Connections (readonly)

LoadBalancer

class @aws-cdk/aws-elasticloadbalancing.LoadBalancer(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.LoadBalancer;
const { LoadBalancer } = require('@aws-cdk/aws-elasticloadbalancing');
import { LoadBalancer } from '@aws-cdk/aws-elasticloadbalancing';

A load balancer with a single listener

Routes to a fleet of of instances in a VPC.

Extends:

@aws-cdk/cdk.Construct

Implements:

@aws-cdk/aws-ec2.IConnectable

Implements:

@aws-cdk/aws-codedeploy-api.ILoadBalancer

Parameters:
addListener(listener) → @aws-cdk/aws-elasticloadbalancing.ListenerPort

Add a backend to the load balancer

Parameters:listener (LoadBalancerListener) –
Returns:A ListenerPort object that controls connections to the listener port
Return type:ListenerPort
addTarget(target)
Parameters:target (ILoadBalancerTarget) –
asCodeDeployLoadBalancer() → @aws-cdk/aws-codedeploy-api.ILoadBalancerProps

Implements @aws-cdk/aws-codedeploy-api.ILoadBalancer.asCodeDeployLoadBalancer()

Specify the CodeDeploy-required properties of this load balancer.

Return type:@aws-cdk/aws-codedeploy-api.ILoadBalancerProps
connections

Implements @aws-cdk/aws-ec2.IConnectable.connections()

Control all connections from and to this load balancer

Type:@aws-cdk/aws-ec2.Connections (readonly)
listenerPorts

An object controlling specifically the connections for each listener added to this load balancer

Type:ListenerPort[] (readonly)
loadBalancerCanonicalHostedZoneName
Type:string (readonly)
loadBalancerDnsName
Type:string (readonly)
loadBalancerName
Type:string (readonly)
loadBalancerSourceSecurityGroupGroupName
Type:string (readonly)
loadBalancerSourceSecurityGroupOwnerAlias
Type:string (readonly)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

LoadBalancerListener (interface)

class @aws-cdk/aws-elasticloadbalancing.LoadBalancerListener

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.LoadBalancerListener;
// LoadBalancerListener is an interface
import { LoadBalancerListener } from '@aws-cdk/aws-elasticloadbalancing';

Add a backend to the load balancer

externalPort

External listening port

Type:number
allowConnectionsFrom

Allow connections to the load balancer from the given set of connection peers

By default, connections will be allowed from anywhere. Set this to an empty list

to deny connections, or supply a custom list of peers to allow connections from

(IP ranges or security groups).

Type:@aws-cdk/aws-ec2.IConnectable[] (optional)
Default:Anywhere
externalProtocol

What public protocol to use for load balancing

Either ‘tcp’, ‘ssl’, ‘http’ or ‘https’.

May be omitted if the external port is either 80 or 443.

Type:LoadBalancingProtocol (optional)
internalPort

Instance listening port

Same as the externalPort if not specified.

Type:number (optional)
Default:externalPort
internalProtocol

What public protocol to use for load balancing

Either ‘tcp’, ‘ssl’, ‘http’ or ‘https’.

May be omitted if the internal port is either 80 or 443.

The instance protocol is ‘tcp’ if the front-end protocol

is ‘tcp’ or ‘ssl’, the instance protocol is ‘http’ if the

front-end protocol is ‘https’.

Type:LoadBalancingProtocol (optional)
policyNames

SSL policy names

Type:string[] (optional)
sslCertificateId

ID of SSL certificate

Type:string (optional)

LoadBalancerProps (interface)

class @aws-cdk/aws-elasticloadbalancing.LoadBalancerProps

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.LoadBalancerProps;
// LoadBalancerProps is an interface
import { LoadBalancerProps } from '@aws-cdk/aws-elasticloadbalancing';

Construction properties for a LoadBalancer

vpc

VPC network of the fleet instances

Type:@aws-cdk/aws-ec2.IVpcNetwork
healthCheck

Health check settings for the load balancing targets.

Not required but recommended.

Type:HealthCheck (optional)
internetFacing

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

Type:boolean (optional)
Default:false
listeners

What listeners to set up for the load balancer.

Can also be added by .addListener()

Type:LoadBalancerListener[] (optional)
targets

What targets to load balance to.

Can also be added by .addTarget()

Type:ILoadBalancerTarget[] (optional)

LoadBalancingProtocol (enum)

class @aws-cdk/aws-elasticloadbalancing.LoadBalancingProtocol

Language-specific names:

using Amazon.CDK.AWS.ElasticLoadBalancing;
import software.amazon.awscdk.services.elasticloadbalancing.LoadBalancingProtocol;
const { LoadBalancingProtocol } = require('@aws-cdk/aws-elasticloadbalancing');
import { LoadBalancingProtocol } from '@aws-cdk/aws-elasticloadbalancing';
Tcp
Ssl
Http
Https