CfnLoadBalancer

class aws_cdk.aws_elasticloadbalancing.CfnLoadBalancer(scope, id, *, listeners, access_logging_policy=None, app_cookie_stickiness_policy=None, availability_zones=None, connection_draining_policy=None, connection_settings=None, cross_zone=None, health_check=None, instances=None, lb_cookie_stickiness_policy=None, load_balancer_name=None, policies=None, scheme=None, security_groups=None, subnets=None, tags=None)

Bases: aws_cdk.core.CfnResource

A CloudFormation AWS::ElasticLoadBalancing::LoadBalancer.

Specifies a Classic Load Balancer.

You can specify the AvailabilityZones or Subnets property, but not both.

If this resource has a public IP address and is also in a VPC that is defined in the same template, you must use the DependsOn attribute to declare a dependency on the VPC-gateway attachment.

CloudformationResource

AWS::ElasticLoadBalancing::LoadBalancer

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_elasticloadbalancing as elb

# attributes: Any

cfn_load_balancer = elb.CfnLoadBalancer(self, "MyCfnLoadBalancer",
    listeners=[elb.CfnLoadBalancer.ListenersProperty(
        instance_port="instancePort",
        load_balancer_port="loadBalancerPort",
        protocol="protocol",

        # the properties below are optional
        instance_protocol="instanceProtocol",
        policy_names=["policyNames"],
        ssl_certificate_id="sslCertificateId"
    )],

    # the properties below are optional
    access_logging_policy=elb.CfnLoadBalancer.AccessLoggingPolicyProperty(
        enabled=False,
        s3_bucket_name="s3BucketName",

        # the properties below are optional
        emit_interval=123,
        s3_bucket_prefix="s3BucketPrefix"
    ),
    app_cookie_stickiness_policy=[elb.CfnLoadBalancer.AppCookieStickinessPolicyProperty(
        cookie_name="cookieName",
        policy_name="policyName"
    )],
    availability_zones=["availabilityZones"],
    connection_draining_policy=elb.CfnLoadBalancer.ConnectionDrainingPolicyProperty(
        enabled=False,

        # the properties below are optional
        timeout=123
    ),
    connection_settings=elb.CfnLoadBalancer.ConnectionSettingsProperty(
        idle_timeout=123
    ),
    cross_zone=False,
    health_check=elb.CfnLoadBalancer.HealthCheckProperty(
        healthy_threshold="healthyThreshold",
        interval="interval",
        target="target",
        timeout="timeout",
        unhealthy_threshold="unhealthyThreshold"
    ),
    instances=["instances"],
    lb_cookie_stickiness_policy=[elb.CfnLoadBalancer.LBCookieStickinessPolicyProperty(
        cookie_expiration_period="cookieExpirationPeriod",
        policy_name="policyName"
    )],
    load_balancer_name="loadBalancerName",
    policies=[elb.CfnLoadBalancer.PoliciesProperty(
        attributes=[attributes],
        policy_name="policyName",
        policy_type="policyType",

        # the properties below are optional
        instance_ports=["instancePorts"],
        load_balancer_ports=["loadBalancerPorts"]
    )],
    scheme="scheme",
    security_groups=["securityGroups"],
    subnets=["subnets"],
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)

Create a new AWS::ElasticLoadBalancing::LoadBalancer.

Parameters
  • scope (Construct) –

    • scope in which this resource is defined.

  • id (str) –

    • scoped id of the resource.

  • listeners (Union[IResolvable, Sequence[Union[ListenersProperty, Dict[str, Any], IResolvable]]]) – The listeners for the load balancer. You can specify at most one listener per port. If you update the properties for a listener, AWS CloudFormation deletes the existing listener and creates a new one with the specified properties. While the new listener is being created, clients cannot connect to the load balancer.

  • access_logging_policy (Union[IResolvable, AccessLoggingPolicyProperty, Dict[str, Any], None]) – Information about where and how access logs are stored for the load balancer.

  • app_cookie_stickiness_policy (Union[IResolvable, Sequence[Union[IResolvable, AppCookieStickinessPolicyProperty, Dict[str, Any]]], None]) – Information about a policy for application-controlled session stickiness.

  • availability_zones (Optional[Sequence[str]]) – The Availability Zones for the load balancer. For load balancers in a VPC, specify Subnets instead. Update requires replacement if you did not previously specify an Availability Zone or if you are removing all Availability Zones. Otherwise, update requires no interruption.

  • connection_draining_policy (Union[IResolvable, ConnectionDrainingPolicyProperty, Dict[str, Any], None]) – If enabled, the load balancer allows existing requests to complete before the load balancer shifts traffic away from a deregistered or unhealthy instance. For more information, see Configure Connection Draining in the Classic Load Balancers Guide .

  • connection_settings (Union[IResolvable, ConnectionSettingsProperty, Dict[str, Any], None]) – If enabled, the load balancer allows the connections to remain idle (no data is sent over the connection) for the specified duration. By default, Elastic Load Balancing maintains a 60-second idle connection timeout for both front-end and back-end connections of your load balancer. For more information, see Configure Idle Connection Timeout in the Classic Load Balancers Guide .

  • cross_zone (Union[bool, IResolvable, None]) – If enabled, the load balancer routes the request traffic evenly across all instances regardless of the Availability Zones. For more information, see Configure Cross-Zone Load Balancing in the Classic Load Balancers Guide .

  • health_check (Union[IResolvable, HealthCheckProperty, Dict[str, Any], None]) – The health check settings to use when evaluating the health of your EC2 instances. Update requires replacement if you did not previously specify health check settings or if you are removing the health check settings. Otherwise, update requires no interruption.

  • instances (Optional[Sequence[str]]) – The IDs of the instances for the load balancer.

  • lb_cookie_stickiness_policy (Union[IResolvable, Sequence[Union[IResolvable, LBCookieStickinessPolicyProperty, Dict[str, Any]]], None]) – Information about a policy for duration-based session stickiness.

  • load_balancer_name (Optional[str]) – The name of the load balancer. This name must be unique within your set of load balancers for the region. If you don’t specify a name, AWS CloudFormation generates a unique physical ID for the load balancer. For more information, see Name Type . If you specify a name, you cannot perform updates that require replacement of this resource, but you can perform other updates. To replace the resource, specify a new name.

  • policies (Union[IResolvable, Sequence[Union[IResolvable, PoliciesProperty, Dict[str, Any]]], None]) – The policies defined for your Classic Load Balancer. Specify only back-end server policies.

  • scheme (Optional[str]) – The type of load balancer. Valid only for load balancers in a VPC. If Scheme is internet-facing , the load balancer has a public DNS name that resolves to a public IP address. If Scheme is internal , the load balancer has a public DNS name that resolves to a private IP address.

  • security_groups (Optional[Sequence[str]]) – The security groups for the load balancer. Valid only for load balancers in a VPC.

  • subnets (Optional[Sequence[str]]) – The IDs of the subnets for the load balancer. You can specify at most one subnet per Availability Zone. Update requires replacement if you did not previously specify a subnet or if you are removing all subnets. Otherwise, update requires no interruption. To update to a different subnet in the current Availability Zone, you must first update to a subnet in a different Availability Zone, then update to the new subnet in the original Availability Zone.

  • tags (Optional[Sequence[Union[CfnTag, Dict[str, Any]]]]) – The tags associated with a load balancer.

Methods

add_deletion_override(path)

Syntactic sugar for addOverride(path, undefined).

Parameters

path (str) – The path of the value to delete.

Return type

None

add_depends_on(target)

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

Parameters

target (CfnResource) –

Return type

None

add_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters
  • key (str) –

  • value (Any) –

See

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

Return type

None

add_override(path, value)

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

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example:

cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"])
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")

would add the overrides Example:

"Properties": {
   "GlobalSecondaryIndexes": [
     {
       "Projection": {
         "NonKeyAttributes": [ "myattribute" ]
         ...
       }
       ...
     },
     {
       "ProjectionType": "INCLUDE"
       ...
     },
   ]
   ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters
  • path (str) –

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

Return type

None

add_property_deletion_override(property_path)

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

Parameters

property_path (str) – The path to the property.

Return type

None

add_property_override(property_path, value)

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

Parameters
  • property_path (str) – The path of the property.

  • value (Any) – The value.

Return type

None

apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)

Sets the deletion policy of the resource based on the removal policy specified.

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

Parameters
  • policy (Optional[RemovalPolicy]) –

  • apply_to_update_replace_policy (Optional[bool]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: true

  • default (Optional[RemovalPolicy]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.

Return type

None

get_att(attribute_name)

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

attribute_name (str) – The name of the attribute.

Return type

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters

key (str) –

See

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

Return type

Any

inspect(inspector)

Examines the CloudFormation resource and discloses attributes.

Parameters

inspector (TreeInspector) –

  • tree inspector to collect and process attributes.

Return type

None

override_logical_id(new_logical_id)

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

Parameters

new_logical_id (str) – The new logical ID to use for this stack element.

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Returns

a string representation of this resource

Attributes

CFN_RESOURCE_TYPE_NAME = 'AWS::ElasticLoadBalancing::LoadBalancer'
access_logging_policy

Information about where and how access logs are stored for the load balancer.

Link

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

Return type

Union[IResolvable, AccessLoggingPolicyProperty, None]

Information about a policy for application-controlled session stickiness.

Link

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

Return type

Union[IResolvable, List[Union[IResolvable, AppCookieStickinessPolicyProperty]], None]

attr_canonical_hosted_zone_name

The name of the Route 53 hosted zone that is associated with the load balancer.

Internal-facing load balancers don’t use this value, use DNSName instead.

CloudformationAttribute

CanonicalHostedZoneName

Return type

str

attr_canonical_hosted_zone_name_id

The ID of the Route 53 hosted zone name that is associated with the load balancer.

CloudformationAttribute

CanonicalHostedZoneNameID

Return type

str

attr_dns_name

The DNS name for the load balancer.

CloudformationAttribute

DNSName

Return type

str

attr_source_security_group_group_name

The name of the security group that you can use as part of your inbound rules for your load balancer’s back-end instances.

CloudformationAttribute

SourceSecurityGroup.GroupName

Return type

str

attr_source_security_group_owner_alias

The owner of the source security group.

CloudformationAttribute

SourceSecurityGroup.OwnerAlias

Return type

str

availability_zones

The Availability Zones for the load balancer. For load balancers in a VPC, specify Subnets instead.

Update requires replacement if you did not previously specify an Availability Zone or if you are removing all Availability Zones. Otherwise, update requires no interruption.

Link

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

Return type

Optional[List[str]]

cfn_options

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

Return type

ICfnResourceOptions

cfn_resource_type

AWS resource type.

Return type

str

connection_draining_policy

If enabled, the load balancer allows existing requests to complete before the load balancer shifts traffic away from a deregistered or unhealthy instance.

For more information, see Configure Connection Draining in the Classic Load Balancers Guide .

Link

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

Return type

Union[IResolvable, ConnectionDrainingPolicyProperty, None]

connection_settings

If enabled, the load balancer allows the connections to remain idle (no data is sent over the connection) for the specified duration.

By default, Elastic Load Balancing maintains a 60-second idle connection timeout for both front-end and back-end connections of your load balancer. For more information, see Configure Idle Connection Timeout in the Classic Load Balancers Guide .

Link

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

Return type

Union[IResolvable, ConnectionSettingsProperty, None]

creation_stack

return:

the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.

Return type

List[str]

cross_zone

If enabled, the load balancer routes the request traffic evenly across all instances regardless of the Availability Zones.

For more information, see Configure Cross-Zone Load Balancing in the Classic Load Balancers Guide .

Link

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

Return type

Union[bool, IResolvable, None]

health_check

The health check settings to use when evaluating the health of your EC2 instances.

Update requires replacement if you did not previously specify health check settings or if you are removing the health check settings. Otherwise, update requires no interruption.

Link

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

Return type

Union[IResolvable, HealthCheckProperty, None]

instances

The IDs of the instances for the load balancer.

Link

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

Return type

Optional[List[str]]

Information about a policy for duration-based session stickiness.

Link

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

Return type

Union[IResolvable, List[Union[IResolvable, LBCookieStickinessPolicyProperty]], None]

listeners

The listeners for the load balancer. You can specify at most one listener per port.

If you update the properties for a listener, AWS CloudFormation deletes the existing listener and creates a new one with the specified properties. While the new listener is being created, clients cannot connect to the load balancer.

Link

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

Return type

Union[IResolvable, List[Union[ListenersProperty, IResolvable]]]

load_balancer_name

The name of the load balancer.

This name must be unique within your set of load balancers for the region.

If you don’t specify a name, AWS CloudFormation generates a unique physical ID for the load balancer. For more information, see Name Type . If you specify a name, you cannot perform updates that require replacement of this resource, but you can perform other updates. To replace the resource, specify a new name.

Link

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

Return type

Optional[str]

logical_id

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

Return type

str

Returns

the logical ID as a stringified token. This value will only get resolved during synthesis.

node

The construct tree node associated with this construct.

Return type

ConstructNode

policies

The policies defined for your Classic Load Balancer.

Specify only back-end server policies.

Link

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

Return type

Union[IResolvable, List[Union[IResolvable, PoliciesProperty]], None]

ref

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

Return type

str

scheme

The type of load balancer. Valid only for load balancers in a VPC.

If Scheme is internet-facing , the load balancer has a public DNS name that resolves to a public IP address.

If Scheme is internal , the load balancer has a public DNS name that resolves to a private IP address.

Link

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

Return type

Optional[str]

security_groups

The security groups for the load balancer.

Valid only for load balancers in a VPC.

Link

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

Return type

Optional[List[str]]

stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

Return type

Stack

subnets

The IDs of the subnets for the load balancer. You can specify at most one subnet per Availability Zone.

Update requires replacement if you did not previously specify a subnet or if you are removing all subnets. Otherwise, update requires no interruption. To update to a different subnet in the current Availability Zone, you must first update to a subnet in a different Availability Zone, then update to the new subnet in the original Availability Zone.

Link

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

Return type

Optional[List[str]]

tags

The tags associated with a load balancer.

Link

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

Return type

TagManager

Static Methods

classmethod is_cfn_element(x)

Returns true if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

Parameters

x (Any) –

Return type

bool

Returns

The construct as a stack element or undefined if it is not a stack element.

classmethod is_cfn_resource(construct)

Check whether the given construct is a CfnResource.

Parameters

construct (IConstruct) –

Return type

bool

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool

AccessLoggingPolicyProperty

class CfnLoadBalancer.AccessLoggingPolicyProperty(*, enabled, s3_bucket_name, emit_interval=None, s3_bucket_prefix=None)

Bases: object

Specifies where and how access logs are stored for your Classic Load Balancer.

Parameters
  • enabled (Union[bool, IResolvable]) – Specifies whether access logs are enabled for the load balancer.

  • s3_bucket_name (str) – The name of the Amazon S3 bucket where the access logs are stored.

  • emit_interval (Union[int, float, None]) – The interval for publishing the access logs. You can specify an interval of either 5 minutes or 60 minutes. Default: 60 minutes

  • s3_bucket_prefix (Optional[str]) – The logical hierarchy you created for your Amazon S3 bucket, for example my-bucket-prefix/prod . If the prefix is not provided, the log is placed at the root level of the bucket.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_elasticloadbalancing as elb

access_logging_policy_property = elb.CfnLoadBalancer.AccessLoggingPolicyProperty(
    enabled=False,
    s3_bucket_name="s3BucketName",

    # the properties below are optional
    emit_interval=123,
    s3_bucket_prefix="s3BucketPrefix"
)

Attributes

emit_interval

The interval for publishing the access logs. You can specify an interval of either 5 minutes or 60 minutes.

Default: 60 minutes

Link

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

Return type

Union[int, float, None]

enabled

Specifies whether access logs are enabled for the load balancer.

Link

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

Return type

Union[bool, IResolvable]

s3_bucket_name

The name of the Amazon S3 bucket where the access logs are stored.

Link

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

Return type

str

s3_bucket_prefix

The logical hierarchy you created for your Amazon S3 bucket, for example my-bucket-prefix/prod .

If the prefix is not provided, the log is placed at the root level of the bucket.

Link

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

Return type

Optional[str]

AppCookieStickinessPolicyProperty

class CfnLoadBalancer.AppCookieStickinessPolicyProperty(*, cookie_name, policy_name)

Bases: object

Specifies a policy for application-controlled session stickiness for your Classic Load Balancer.

To associate a policy with a listener, use the PolicyNames property for the listener.

Parameters
  • cookie_name (str) – The name of the application cookie used for stickiness.

  • policy_name (str) – The mnemonic name for the policy being created. The name must be unique within a set of policies for this load balancer.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_elasticloadbalancing as elb

app_cookie_stickiness_policy_property = elb.CfnLoadBalancer.AppCookieStickinessPolicyProperty(
    cookie_name="cookieName",
    policy_name="policyName"
)

Attributes

cookie_name

The name of the application cookie used for stickiness.

Link

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

Return type

str

policy_name

The mnemonic name for the policy being created.

The name must be unique within a set of policies for this load balancer.

Link

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

Return type

str

ConnectionDrainingPolicyProperty

class CfnLoadBalancer.ConnectionDrainingPolicyProperty(*, enabled, timeout=None)

Bases: object

Specifies the connection draining settings for your Classic Load Balancer.

Parameters
  • enabled (Union[bool, IResolvable]) – Specifies whether connection draining is enabled for the load balancer.

  • timeout (Union[int, float, None]) – The maximum time, in seconds, to keep the existing connections open before deregistering the instances.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_elasticloadbalancing as elb

connection_draining_policy_property = elb.CfnLoadBalancer.ConnectionDrainingPolicyProperty(
    enabled=False,

    # the properties below are optional
    timeout=123
)

Attributes

enabled

Specifies whether connection draining is enabled for the load balancer.

Link

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

Return type

Union[bool, IResolvable]

timeout

The maximum time, in seconds, to keep the existing connections open before deregistering the instances.

Link

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

Return type

Union[int, float, None]

ConnectionSettingsProperty

class CfnLoadBalancer.ConnectionSettingsProperty(*, idle_timeout)

Bases: object

Specifies the idle timeout value for your Classic Load Balancer.

Parameters

idle_timeout (Union[int, float]) – The time, in seconds, that the connection is allowed to be idle (no data has been sent over the connection) before it is closed by the load balancer.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_elasticloadbalancing as elb

connection_settings_property = elb.CfnLoadBalancer.ConnectionSettingsProperty(
    idle_timeout=123
)

Attributes

idle_timeout

The time, in seconds, that the connection is allowed to be idle (no data has been sent over the connection) before it is closed by the load balancer.

Link

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

Return type

Union[int, float]

HealthCheckProperty

class CfnLoadBalancer.HealthCheckProperty(*, healthy_threshold, interval, target, timeout, unhealthy_threshold)

Bases: object

Specifies health check settings for your Classic Load Balancer.

Parameters
  • healthy_threshold (str) – The number of consecutive health checks successes required before moving the instance to the Healthy state.

  • interval (str) – The approximate interval, in seconds, between health checks of an individual instance.

  • target (str) – The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535. TCP is the default, specified as a TCP: port pair, for example “TCP:5000”. In this case, a health check simply attempts to open a TCP connection to the instance on the specified port. Failure to connect within the configured timeout is considered unhealthy. SSL is also specified as SSL: port pair, for example, SSL:5000. For HTTP/HTTPS, you must include a ping path in the string. HTTP is specified as a HTTP:port;/;PathToPing; grouping, for example “HTTP:80/weather/us/wa/seattle”. In this case, a HTTP GET request is issued to the instance on the given port and path. Any answer other than “200 OK” within the timeout period is considered unhealthy. The total length of the HTTP ping target must be 1024 16-bit Unicode characters or less.

  • timeout (str) – The amount of time, in seconds, during which no response means a failed health check. This value must be less than the Interval value.

  • unhealthy_threshold (str) – The number of consecutive health check failures required before moving the instance to the Unhealthy state.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_elasticloadbalancing as elb

health_check_property = elb.CfnLoadBalancer.HealthCheckProperty(
    healthy_threshold="healthyThreshold",
    interval="interval",
    target="target",
    timeout="timeout",
    unhealthy_threshold="unhealthyThreshold"
)

Attributes

healthy_threshold

The number of consecutive health checks successes required before moving the instance to the Healthy state.

Link

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

Return type

str

interval

The approximate interval, in seconds, between health checks of an individual instance.

Link

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

Return type

str

target

The instance being checked.

The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535.

TCP is the default, specified as a TCP: port pair, for example “TCP:5000”. In this case, a health check simply attempts to open a TCP connection to the instance on the specified port. Failure to connect within the configured timeout is considered unhealthy.

SSL is also specified as SSL: port pair, for example, SSL:5000.

For HTTP/HTTPS, you must include a ping path in the string. HTTP is specified as a HTTP:port;/;PathToPing; grouping, for example “HTTP:80/weather/us/wa/seattle”. In this case, a HTTP GET request is issued to the instance on the given port and path. Any answer other than “200 OK” within the timeout period is considered unhealthy.

The total length of the HTTP ping target must be 1024 16-bit Unicode characters or less.

Link

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

Return type

str

timeout

The amount of time, in seconds, during which no response means a failed health check.

This value must be less than the Interval value.

Link

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

Return type

str

unhealthy_threshold

The number of consecutive health check failures required before moving the instance to the Unhealthy state.

Link

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

Return type

str

LBCookieStickinessPolicyProperty

class CfnLoadBalancer.LBCookieStickinessPolicyProperty(*, cookie_expiration_period=None, policy_name=None)

Bases: object

Specifies a policy for duration-based session stickiness for your Classic Load Balancer.

To associate a policy with a listener, use the PolicyNames property for the listener.

Parameters
  • cookie_expiration_period (Optional[str]) – The time period, in seconds, after which the cookie should be considered stale. If this parameter is not specified, the stickiness session lasts for the duration of the browser session.

  • policy_name (Optional[str]) – The name of the policy. This name must be unique within the set of policies for this load balancer.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_elasticloadbalancing as elb

l_bCookie_stickiness_policy_property = elb.CfnLoadBalancer.LBCookieStickinessPolicyProperty(
    cookie_expiration_period="cookieExpirationPeriod",
    policy_name="policyName"
)

Attributes

cookie_expiration_period

The time period, in seconds, after which the cookie should be considered stale.

If this parameter is not specified, the stickiness session lasts for the duration of the browser session.

Link

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

Return type

Optional[str]

policy_name

The name of the policy.

This name must be unique within the set of policies for this load balancer.

Link

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

Return type

Optional[str]

ListenersProperty

class CfnLoadBalancer.ListenersProperty(*, instance_port, load_balancer_port, protocol, instance_protocol=None, policy_names=None, ssl_certificate_id=None)

Bases: object

Specifies a listener for your Classic Load Balancer.

Parameters
  • instance_port (str) – The port on which the instance is listening.

  • load_balancer_port (str) – The port on which the load balancer is listening. On EC2-VPC, you can specify any port from the range 1-65535. On EC2-Classic, you can specify any port from the following list: 25, 80, 443, 465, 587, 1024-65535.

  • protocol (str) – The load balancer transport protocol to use for routing: HTTP, HTTPS, TCP, or SSL.

  • instance_protocol (Optional[str]) – The protocol to use for routing traffic to instances: HTTP, HTTPS, TCP, or SSL. If the front-end protocol is TCP or SSL, the back-end protocol must be TCP or SSL. If the front-end protocol is HTTP or HTTPS, the back-end protocol must be HTTP or HTTPS. If there is another listener with the same InstancePort whose InstanceProtocol is secure, (HTTPS or SSL), the listener’s InstanceProtocol must also be secure. If there is another listener with the same InstancePort whose InstanceProtocol is HTTP or TCP, the listener’s InstanceProtocol must be HTTP or TCP.

  • policy_names (Optional[Sequence[str]]) – The names of the policies to associate with the listener.

  • ssl_certificate_id (Optional[str]) – The Amazon Resource Name (ARN) of the server certificate.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_elasticloadbalancing as elb

listeners_property = elb.CfnLoadBalancer.ListenersProperty(
    instance_port="instancePort",
    load_balancer_port="loadBalancerPort",
    protocol="protocol",

    # the properties below are optional
    instance_protocol="instanceProtocol",
    policy_names=["policyNames"],
    ssl_certificate_id="sslCertificateId"
)

Attributes

instance_port

The port on which the instance is listening.

Link

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

Return type

str

instance_protocol

HTTP, HTTPS, TCP, or SSL.

If the front-end protocol is TCP or SSL, the back-end protocol must be TCP or SSL. If the front-end protocol is HTTP or HTTPS, the back-end protocol must be HTTP or HTTPS.

If there is another listener with the same InstancePort whose InstanceProtocol is secure, (HTTPS or SSL), the listener’s InstanceProtocol must also be secure.

If there is another listener with the same InstancePort whose InstanceProtocol is HTTP or TCP, the listener’s InstanceProtocol must be HTTP or TCP.

Link

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

Type

The protocol to use for routing traffic to instances

Return type

Optional[str]

load_balancer_port

The port on which the load balancer is listening.

On EC2-VPC, you can specify any port from the range 1-65535. On EC2-Classic, you can specify any port from the following list: 25, 80, 443, 465, 587, 1024-65535.

Link

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

Return type

str

policy_names

The names of the policies to associate with the listener.

Link

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

Return type

Optional[List[str]]

protocol

HTTP, HTTPS, TCP, or SSL.

Link

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

Type

The load balancer transport protocol to use for routing

Return type

str

ssl_certificate_id

The Amazon Resource Name (ARN) of the server certificate.

Link

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

Return type

Optional[str]

PoliciesProperty

class CfnLoadBalancer.PoliciesProperty(*, attributes, policy_name, policy_type, instance_ports=None, load_balancer_ports=None)

Bases: object

Specifies policies for your Classic Load Balancer.

To associate policies with a listener, use the PolicyNames property for the listener.

Parameters
  • attributes (Union[Sequence[Any], IResolvable]) – The policy attributes.

  • policy_name (str) – The name of the policy.

  • policy_type (str) – The name of the policy type.

  • instance_ports (Optional[Sequence[str]]) – The instance ports for the policy. Required only for some policy types.

  • load_balancer_ports (Optional[Sequence[str]]) – The load balancer ports for the policy. Required only for some policy types.

Link

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_elasticloadbalancing as elb

# attributes: Any

policies_property = elb.CfnLoadBalancer.PoliciesProperty(
    attributes=[attributes],
    policy_name="policyName",
    policy_type="policyType",

    # the properties below are optional
    instance_ports=["instancePorts"],
    load_balancer_ports=["loadBalancerPorts"]
)

Attributes

attributes

The policy attributes.

Link

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

Return type

Union[List[Any], IResolvable]

instance_ports

The instance ports for the policy.

Required only for some policy types.

Link

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

Return type

Optional[List[str]]

load_balancer_ports

The load balancer ports for the policy.

Required only for some policy types.

Link

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

Return type

Optional[List[str]]

policy_name

The name of the policy.

Link

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

Return type

str

policy_type

The name of the policy type.

Link

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

Return type

str