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: CfnResource

Specifies a Classic Load Balancer.

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancing-loadbalancer.html

CloudformationResource:

AWS::ElasticLoadBalancing::LoadBalancer

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import 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"
    )]
)
Parameters:
  • scope (Construct) – Scope in which this resource is defined.

  • id (str) – Construct identifier for this resource (unique in its scope).

  • listeners (Union[IResolvable, Sequence[Union[IResolvable, ListenersProperty, Dict[str, Any]]]]) – 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 a load balancer in a default VPC. For a load balancer in a nondefault 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 User Guide for Classic Load Balancers .

  • 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 User Guide for Classic Load Balancers .

  • 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 User Guide for Classic Load Balancers .

  • 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_dependency(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_depends_on(target)

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

Parameters:

target (CfnResource) –

Deprecated:

use addDependency

Stability:

deprecated

Return type:

None

add_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters:
  • key (str) –

  • value (Any) –

See:

Return type:

None

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.

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 intermediate 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). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:

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 resource, please consult that specific resource’s documentation.

See:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options

Return type:

None

get_att(attribute_name, type_hint=None)

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.

  • type_hint (Optional[ResolutionTypeHint]) –

Return type:

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters:

key (str) –

See:

Return type:

Any

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.

inspect(inspector)

Examines the CloudFormation resource and discloses attributes.

Parameters:

inspector (TreeInspector) – tree inspector to collect and process attributes.

Return type:

None

obtain_dependencies()

Retrieves an array of resources this resource depends on.

This assembles dependencies on resources across stacks (including nested stacks) automatically.

Return type:

List[Union[Stack, CfnResource]]

obtain_resource_dependencies()

Get a shallow copy of dependencies between this resource and other resources in the same stack.

Return type:

List[CfnResource]

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

remove_dependency(target)

Indicates that this resource no longer depends on another resource.

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.

Parameters:

target (CfnResource) –

Return type:

None

replace_dependency(target, new_target)

Replaces one dependency with another.

Parameters:
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.

Information about a policy for application-controlled session stickiness.

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

attr_canonical_hosted_zone_name_id

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

CloudformationAttribute:

CanonicalHostedZoneNameID

attr_dns_name

The DNS name for the load balancer.

CloudformationAttribute:

DNSName

attr_id

Id

Type:

cloudformationAttribute

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

attr_source_security_group_owner_alias

The owner of the source security group.

CloudformationAttribute:

SourceSecurityGroup.OwnerAlias

availability_zones

The Availability Zones for a load balancer in a default VPC.

cfn_options

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

cfn_resource_type

AWS resource type.

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.

connection_settings

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

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.

cross_zone

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

health_check

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

instances

The IDs of the instances for the load balancer.

Information about a policy for duration-based session stickiness.

listeners

The listeners for the load balancer.

You can specify at most one listener per port.

load_balancer_name

The name of the load balancer.

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

Returns:

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

node

The tree node.

policies

The policies defined for your Classic Load Balancer.

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

scheme

The type of load balancer.

Valid only for load balancers in a VPC.

security_groups

The security groups for the load balancer.

stack

The stack in which this element is defined.

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

subnets

The IDs of the subnets for the load balancer.

You can specify at most one subnet per Availability Zone.

tags

Tag Manager which manages the tags for this resource.

tags_raw

The tags associated with a load balancer.

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(x)

Check whether the given object is a CfnResource.

Parameters:

x (Any) –

Return type:

bool

classmethod is_construct(x)

Checks if x is a construct.

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:

x (Any) – Any object.

Return type:

bool

Returns:

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

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-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.
from aws_cdk import 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

See:

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

enabled

Specifies whether access logs are enabled for the load balancer.

See:

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

s3_bucket_name

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

See:

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

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.

See:

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

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-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.
from aws_cdk import 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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-appcookiestickinesspolicy.html#cfn-elasticloadbalancing-loadbalancer-appcookiestickinesspolicy-cookiename

policy_name

The mnemonic name for the policy being created.

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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-appcookiestickinesspolicy.html#cfn-elasticloadbalancing-loadbalancer-appcookiestickinesspolicy-policyname

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-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.
from aws_cdk import 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.

See:

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

timeout

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

See:

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

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-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.
from aws_cdk import 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.

See:

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

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-healthcheck.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import 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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-healthcheck.html#cfn-elasticloadbalancing-loadbalancer-healthcheck-healthythreshold

interval

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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-healthcheck.html#cfn-elasticloadbalancing-loadbalancer-healthcheck-interval

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-healthcheck.html#cfn-elasticloadbalancing-loadbalancer-healthcheck-target

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-healthcheck.html#cfn-elasticloadbalancing-loadbalancer-healthcheck-timeout

unhealthy_threshold

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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-healthcheck.html#cfn-elasticloadbalancing-loadbalancer-healthcheck-unhealthythreshold

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-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.
from aws_cdk import 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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-lbcookiestickinesspolicy.html#cfn-elasticloadbalancing-loadbalancer-lbcookiestickinesspolicy-cookieexpirationperiod

policy_name

The name of the policy.

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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-lbcookiestickinesspolicy.html#cfn-elasticloadbalancing-loadbalancer-lbcookiestickinesspolicy-policyname

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.

Modifying any property replaces the listener.

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-listeners.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import 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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-listeners.html#cfn-elasticloadbalancing-loadbalancer-listeners-instanceport

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-listeners.html#cfn-elasticloadbalancing-loadbalancer-listeners-instanceprotocol

Type:

The protocol to use for routing traffic to instances

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-listeners.html#cfn-elasticloadbalancing-loadbalancer-listeners-loadbalancerport

policy_names

The names of the policies to associate with the listener.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-listeners.html#cfn-elasticloadbalancing-loadbalancer-listeners-policynames

protocol

HTTP, HTTPS, TCP, or SSL.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-listeners.html#cfn-elasticloadbalancing-loadbalancer-listeners-protocol

Type:

The load balancer transport protocol to use for routing

ssl_certificate_id

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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-listeners.html#cfn-elasticloadbalancing-loadbalancer-listeners-sslcertificateid

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-policies.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import 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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-policies.html#cfn-elasticloadbalancing-loadbalancer-policies-attributes

instance_ports

The instance ports for the policy.

Required only for some policy types.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-policies.html#cfn-elasticloadbalancing-loadbalancer-policies-instanceports

load_balancer_ports

The load balancer ports for the policy.

Required only for some policy types.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-policies.html#cfn-elasticloadbalancing-loadbalancer-policies-loadbalancerports

policy_name

The name of the policy.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-policies.html#cfn-elasticloadbalancing-loadbalancer-policies-policyname

policy_type

The name of the policy type.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancing-loadbalancer-policies.html#cfn-elasticloadbalancing-loadbalancer-policies-policytype