Elastic Load Balancing

2017/08/31 - Elastic Load Balancing - 6 updated api methods

CreateTargetGroup (updated) Link ¶
Changes (request, response)
Request
{'TargetType': 'instance | ip'}
Response
{'TargetGroups': {'TargetType': 'instance | ip'}}

Creates a target group.

To register targets with the target group, use RegisterTargets. To update the health check settings for the target group, use ModifyTargetGroup. To monitor the health of targets in the target group, use DescribeTargetHealth.

To route traffic to the targets in a target group, specify the target group in an action using CreateListener or CreateRule.

To delete a target group, use DeleteTargetGroup.

For more information, see Target Groups for Your Application Load Balancers in the Application Load Balancers Guide .

See also: AWS API Documentation

Request Syntax

client.create_target_group(
    Name='string',
    Protocol='HTTP'|'HTTPS',
    Port=123,
    VpcId='string',
    HealthCheckProtocol='HTTP'|'HTTPS',
    HealthCheckPort='string',
    HealthCheckPath='string',
    HealthCheckIntervalSeconds=123,
    HealthCheckTimeoutSeconds=123,
    HealthyThresholdCount=123,
    UnhealthyThresholdCount=123,
    Matcher={
        'HttpCode': 'string'
    },
    TargetType='instance'|'ip'
)
type Name

string

param Name

[REQUIRED]

The name of the target group.

This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.

type Protocol

string

param Protocol

[REQUIRED]

The protocol to use for routing traffic to the targets.

type Port

integer

param Port

[REQUIRED]

The port on which the targets receive traffic. This port is used unless you specify a port override when registering the target.

type VpcId

string

param VpcId

[REQUIRED]

The identifier of the virtual private cloud (VPC).

type HealthCheckProtocol

string

param HealthCheckProtocol

The protocol the load balancer uses when performing health checks on targets. The default is the HTTP protocol.

type HealthCheckPort

string

param HealthCheckPort

The port the load balancer uses when performing health checks on targets. The default is traffic-port , which indicates the port on which each target receives traffic from the load balancer.

type HealthCheckPath

string

param HealthCheckPath

The ping path that is the destination on the targets for health checks. The default is /.

type HealthCheckIntervalSeconds

integer

param HealthCheckIntervalSeconds

The approximate amount of time, in seconds, between health checks of an individual target. The default is 30 seconds.

type HealthCheckTimeoutSeconds

integer

param HealthCheckTimeoutSeconds

The amount of time, in seconds, during which no response from a target means a failed health check. The default is 5 seconds.

type HealthyThresholdCount

integer

param HealthyThresholdCount

The number of consecutive health checks successes required before considering an unhealthy target healthy. The default is 5.

type UnhealthyThresholdCount

integer

param UnhealthyThresholdCount

The number of consecutive health check failures required before considering a target unhealthy. The default is 2.

type Matcher

dict

param Matcher

The HTTP codes to use when checking for a successful response from a target. The default is 200.

  • HttpCode (string) -- [REQUIRED]

    The HTTP codes. You can specify values between 200 and 499. The default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").

type TargetType

string

param TargetType

The type of target that you must specify when registering targets with this target group. The possible values are instance (targets are specified by instance ID) or ip (targets are specified by IP address). The default is instance . Note that you can't specify targets for a target group using both instance IDs and IP addresses.

If the target type is ip , specify IP addresses from the subnets of the virtual private cloud (VPC) for the target group, the RFC 1918 range (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16), and the RFC 6598 range (100.64.0.0/10). You can't specify publicly routable IP addresses.

rtype

dict

returns

Response Syntax

{
    'TargetGroups': [
        {
            'TargetGroupArn': 'string',
            'TargetGroupName': 'string',
            'Protocol': 'HTTP'|'HTTPS',
            'Port': 123,
            'VpcId': 'string',
            'HealthCheckProtocol': 'HTTP'|'HTTPS',
            'HealthCheckPort': 'string',
            'HealthCheckIntervalSeconds': 123,
            'HealthCheckTimeoutSeconds': 123,
            'HealthyThresholdCount': 123,
            'UnhealthyThresholdCount': 123,
            'HealthCheckPath': 'string',
            'Matcher': {
                'HttpCode': 'string'
            },
            'LoadBalancerArns': [
                'string',
            ],
            'TargetType': 'instance'|'ip'
        },
    ]
}

Response Structure

  • (dict) --

    • TargetGroups (list) --

      Information about the target group.

      • (dict) --

        Information about a target group.

        • TargetGroupArn (string) --

          The Amazon Resource Name (ARN) of the target group.

        • TargetGroupName (string) --

          The name of the target group.

        • Protocol (string) --

          The protocol to use for routing traffic to the targets.

        • Port (integer) --

          The port on which the targets are listening.

        • VpcId (string) --

          The ID of the VPC for the targets.

        • HealthCheckProtocol (string) --

          The protocol to use to connect with the target.

        • HealthCheckPort (string) --

          The port to use to connect with the target.

        • HealthCheckIntervalSeconds (integer) --

          The approximate amount of time, in seconds, between health checks of an individual target.

        • HealthCheckTimeoutSeconds (integer) --

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

        • HealthyThresholdCount (integer) --

          The number of consecutive health checks successes required before considering an unhealthy target healthy.

        • UnhealthyThresholdCount (integer) --

          The number of consecutive health check failures required before considering the target unhealthy.

        • HealthCheckPath (string) --

          The destination for the health check request.

        • Matcher (dict) --

          The HTTP codes to use when checking for a successful response from a target.

          • HttpCode (string) --

            The HTTP codes. You can specify values between 200 and 499. The default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").

        • LoadBalancerArns (list) --

          The Amazon Resource Names (ARN) of the load balancers that route traffic to this target group.

          • (string) --

        • TargetType (string) --

          The type of target that you must specify when registering targets with this target group. The possible values are instance (targets are specified by instance ID) or ip (targets are specified by IP address).

DeregisterTargets (updated) Link ¶
Changes (request)
{'Targets': {'AvailabilityZone': 'string'}}

Deregisters the specified targets from the specified target group. After the targets are deregistered, they no longer receive traffic from the load balancer.

See also: AWS API Documentation

Request Syntax

client.deregister_targets(
    TargetGroupArn='string',
    Targets=[
        {
            'Id': 'string',
            'Port': 123,
            'AvailabilityZone': 'string'
        },
    ]
)
type TargetGroupArn

string

param TargetGroupArn

[REQUIRED]

The Amazon Resource Name (ARN) of the target group.

type Targets

list

param Targets

[REQUIRED]

The targets. If you specified a port override when you registered a target, you must specify both the target ID and the port when you deregister it.

  • (dict) --

    Information about a target.

    • Id (string) -- [REQUIRED]

      The ID of the target. If the target type of the target group is instance , specify an instance ID. If the target type is ip , specify an IP address.

    • Port (integer) --

      The port on which the target is listening.

    • AvailabilityZone (string) --

      The Availability Zone where the IP address is to be registered. Specify all to register an IP address outside the target group VPC with all Availability Zones that are enabled for the load balancer.

      If the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional.

      This parameter is not supported if the target type of the target group is instance .

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

DescribeTargetGroups (updated) Link ¶
Changes (response)
{'TargetGroups': {'TargetType': 'instance | ip'}}

Describes the specified target groups or all of your target groups. By default, all target groups are described. Alternatively, you can specify one of the following to filter the results: the ARN of the load balancer, the names of one or more target groups, or the ARNs of one or more target groups.

To describe the targets for a target group, use DescribeTargetHealth. To describe the attributes of a target group, use DescribeTargetGroupAttributes.

See also: AWS API Documentation

Request Syntax

client.describe_target_groups(
    LoadBalancerArn='string',
    TargetGroupArns=[
        'string',
    ],
    Names=[
        'string',
    ],
    Marker='string',
    PageSize=123
)
type LoadBalancerArn

string

param LoadBalancerArn

The Amazon Resource Name (ARN) of the load balancer.

type TargetGroupArns

list

param TargetGroupArns

The Amazon Resource Names (ARN) of the target groups.

  • (string) --

type Names

list

param Names

The names of the target groups.

  • (string) --

type Marker

string

param Marker

The marker for the next set of results. (You received this marker from a previous call.)

type PageSize

integer

param PageSize

The maximum number of results to return with this call.

rtype

dict

returns

Response Syntax

{
    'TargetGroups': [
        {
            'TargetGroupArn': 'string',
            'TargetGroupName': 'string',
            'Protocol': 'HTTP'|'HTTPS',
            'Port': 123,
            'VpcId': 'string',
            'HealthCheckProtocol': 'HTTP'|'HTTPS',
            'HealthCheckPort': 'string',
            'HealthCheckIntervalSeconds': 123,
            'HealthCheckTimeoutSeconds': 123,
            'HealthyThresholdCount': 123,
            'UnhealthyThresholdCount': 123,
            'HealthCheckPath': 'string',
            'Matcher': {
                'HttpCode': 'string'
            },
            'LoadBalancerArns': [
                'string',
            ],
            'TargetType': 'instance'|'ip'
        },
    ],
    'NextMarker': 'string'
}

Response Structure

  • (dict) --

    • TargetGroups (list) --

      Information about the target groups.

      • (dict) --

        Information about a target group.

        • TargetGroupArn (string) --

          The Amazon Resource Name (ARN) of the target group.

        • TargetGroupName (string) --

          The name of the target group.

        • Protocol (string) --

          The protocol to use for routing traffic to the targets.

        • Port (integer) --

          The port on which the targets are listening.

        • VpcId (string) --

          The ID of the VPC for the targets.

        • HealthCheckProtocol (string) --

          The protocol to use to connect with the target.

        • HealthCheckPort (string) --

          The port to use to connect with the target.

        • HealthCheckIntervalSeconds (integer) --

          The approximate amount of time, in seconds, between health checks of an individual target.

        • HealthCheckTimeoutSeconds (integer) --

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

        • HealthyThresholdCount (integer) --

          The number of consecutive health checks successes required before considering an unhealthy target healthy.

        • UnhealthyThresholdCount (integer) --

          The number of consecutive health check failures required before considering the target unhealthy.

        • HealthCheckPath (string) --

          The destination for the health check request.

        • Matcher (dict) --

          The HTTP codes to use when checking for a successful response from a target.

          • HttpCode (string) --

            The HTTP codes. You can specify values between 200 and 499. The default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").

        • LoadBalancerArns (list) --

          The Amazon Resource Names (ARN) of the load balancers that route traffic to this target group.

          • (string) --

        • TargetType (string) --

          The type of target that you must specify when registering targets with this target group. The possible values are instance (targets are specified by instance ID) or ip (targets are specified by IP address).

    • NextMarker (string) --

      The marker to use when requesting the next set of results. If there are no additional results, the string is empty.

DescribeTargetHealth (updated) Link ¶
Changes (request, response)
Request
{'Targets': {'AvailabilityZone': 'string'}}
Response
{'TargetHealthDescriptions': {'Target': {'AvailabilityZone': 'string'},
                              'TargetHealth': {'Reason': {'Target.IpUnusable'}}}}

Describes the health of the specified targets or all of your targets.

See also: AWS API Documentation

Request Syntax

client.describe_target_health(
    TargetGroupArn='string',
    Targets=[
        {
            'Id': 'string',
            'Port': 123,
            'AvailabilityZone': 'string'
        },
    ]
)
type TargetGroupArn

string

param TargetGroupArn

[REQUIRED]

The Amazon Resource Name (ARN) of the target group.

type Targets

list

param Targets

The targets.

  • (dict) --

    Information about a target.

    • Id (string) -- [REQUIRED]

      The ID of the target. If the target type of the target group is instance , specify an instance ID. If the target type is ip , specify an IP address.

    • Port (integer) --

      The port on which the target is listening.

    • AvailabilityZone (string) --

      The Availability Zone where the IP address is to be registered. Specify all to register an IP address outside the target group VPC with all Availability Zones that are enabled for the load balancer.

      If the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional.

      This parameter is not supported if the target type of the target group is instance .

rtype

dict

returns

Response Syntax

{
    'TargetHealthDescriptions': [
        {
            'Target': {
                'Id': 'string',
                'Port': 123,
                'AvailabilityZone': 'string'
            },
            'HealthCheckPort': 'string',
            'TargetHealth': {
                'State': 'initial'|'healthy'|'unhealthy'|'unused'|'draining',
                'Reason': 'Elb.RegistrationInProgress'|'Elb.InitialHealthChecking'|'Target.ResponseCodeMismatch'|'Target.Timeout'|'Target.FailedHealthChecks'|'Target.NotRegistered'|'Target.NotInUse'|'Target.DeregistrationInProgress'|'Target.InvalidState'|'Target.IpUnusable'|'Elb.InternalError',
                'Description': 'string'
            }
        },
    ]
}

Response Structure

  • (dict) --

    • TargetHealthDescriptions (list) --

      Information about the health of the targets.

      • (dict) --

        Information about the health of a target.

        • Target (dict) --

          The description of the target.

          • Id (string) --

            The ID of the target. If the target type of the target group is instance , specify an instance ID. If the target type is ip , specify an IP address.

          • Port (integer) --

            The port on which the target is listening.

          • AvailabilityZone (string) --

            The Availability Zone where the IP address is to be registered. Specify all to register an IP address outside the target group VPC with all Availability Zones that are enabled for the load balancer.

            If the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional.

            This parameter is not supported if the target type of the target group is instance .

        • HealthCheckPort (string) --

          The port to use to connect with the target.

        • TargetHealth (dict) --

          The health information for the target.

          • State (string) --

            The state of the target.

          • Reason (string) --

            The reason code. If the target state is healthy , a reason code is not provided.

            If the target state is initial , the reason code can be one of the following values:

            • Elb.RegistrationInProgress - The target is in the process of being registered with the load balancer.

            • Elb.InitialHealthChecking - The load balancer is still sending the target the minimum number of health checks required to determine its health status.

            If the target state is unhealthy , the reason code can be one of the following values:

            • Target.ResponseCodeMismatch - The health checks did not return an expected HTTP code.

            • Target.Timeout - The health check requests timed out.

            • Target.FailedHealthChecks - The health checks failed because the connection to the target timed out, the target response was malformed, or the target failed the health check for an unknown reason.

            • Elb.InternalError - The health checks failed due to an internal error.

            If the target state is unused , the reason code can be one of the following values:

            • Target.NotRegistered - The target is not registered with the target group.

            • Target.NotInUse - The target group is not used by any load balancer or the target is in an Availability Zone that is not enabled for its load balancer.

            • Target.InvalidState - The target is in the stopped or terminated state.

            If the target state is draining , the reason code can be the following value:

            • Target.DeregistrationInProgress - The target is in the process of being deregistered and the deregistration delay period has not expired.

          • Description (string) --

            A description of the target health that provides additional details. If the state is healthy , a description is not provided.

ModifyTargetGroup (updated) Link ¶
Changes (response)
{'TargetGroups': {'TargetType': 'instance | ip'}}

Modifies the health checks used when evaluating the health state of the targets in the specified target group.

To monitor the health of the targets, use DescribeTargetHealth.

See also: AWS API Documentation

Request Syntax

client.modify_target_group(
    TargetGroupArn='string',
    HealthCheckProtocol='HTTP'|'HTTPS',
    HealthCheckPort='string',
    HealthCheckPath='string',
    HealthCheckIntervalSeconds=123,
    HealthCheckTimeoutSeconds=123,
    HealthyThresholdCount=123,
    UnhealthyThresholdCount=123,
    Matcher={
        'HttpCode': 'string'
    }
)
type TargetGroupArn

string

param TargetGroupArn

[REQUIRED]

The Amazon Resource Name (ARN) of the target group.

type HealthCheckProtocol

string

param HealthCheckProtocol

The protocol to use to connect with the target.

type HealthCheckPort

string

param HealthCheckPort

The port to use to connect with the target.

type HealthCheckPath

string

param HealthCheckPath

The ping path that is the destination for the health check request.

type HealthCheckIntervalSeconds

integer

param HealthCheckIntervalSeconds

The approximate amount of time, in seconds, between health checks of an individual target.

type HealthCheckTimeoutSeconds

integer

param HealthCheckTimeoutSeconds

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

type HealthyThresholdCount

integer

param HealthyThresholdCount

The number of consecutive health checks successes required before considering an unhealthy target healthy.

type UnhealthyThresholdCount

integer

param UnhealthyThresholdCount

The number of consecutive health check failures required before considering the target unhealthy.

type Matcher

dict

param Matcher

The HTTP codes to use when checking for a successful response from a target.

  • HttpCode (string) -- [REQUIRED]

    The HTTP codes. You can specify values between 200 and 499. The default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").

rtype

dict

returns

Response Syntax

{
    'TargetGroups': [
        {
            'TargetGroupArn': 'string',
            'TargetGroupName': 'string',
            'Protocol': 'HTTP'|'HTTPS',
            'Port': 123,
            'VpcId': 'string',
            'HealthCheckProtocol': 'HTTP'|'HTTPS',
            'HealthCheckPort': 'string',
            'HealthCheckIntervalSeconds': 123,
            'HealthCheckTimeoutSeconds': 123,
            'HealthyThresholdCount': 123,
            'UnhealthyThresholdCount': 123,
            'HealthCheckPath': 'string',
            'Matcher': {
                'HttpCode': 'string'
            },
            'LoadBalancerArns': [
                'string',
            ],
            'TargetType': 'instance'|'ip'
        },
    ]
}

Response Structure

  • (dict) --

    • TargetGroups (list) --

      Information about the target group.

      • (dict) --

        Information about a target group.

        • TargetGroupArn (string) --

          The Amazon Resource Name (ARN) of the target group.

        • TargetGroupName (string) --

          The name of the target group.

        • Protocol (string) --

          The protocol to use for routing traffic to the targets.

        • Port (integer) --

          The port on which the targets are listening.

        • VpcId (string) --

          The ID of the VPC for the targets.

        • HealthCheckProtocol (string) --

          The protocol to use to connect with the target.

        • HealthCheckPort (string) --

          The port to use to connect with the target.

        • HealthCheckIntervalSeconds (integer) --

          The approximate amount of time, in seconds, between health checks of an individual target.

        • HealthCheckTimeoutSeconds (integer) --

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

        • HealthyThresholdCount (integer) --

          The number of consecutive health checks successes required before considering an unhealthy target healthy.

        • UnhealthyThresholdCount (integer) --

          The number of consecutive health check failures required before considering the target unhealthy.

        • HealthCheckPath (string) --

          The destination for the health check request.

        • Matcher (dict) --

          The HTTP codes to use when checking for a successful response from a target.

          • HttpCode (string) --

            The HTTP codes. You can specify values between 200 and 499. The default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").

        • LoadBalancerArns (list) --

          The Amazon Resource Names (ARN) of the load balancers that route traffic to this target group.

          • (string) --

        • TargetType (string) --

          The type of target that you must specify when registering targets with this target group. The possible values are instance (targets are specified by instance ID) or ip (targets are specified by IP address).

RegisterTargets (updated) Link ¶
Changes (request)
{'Targets': {'AvailabilityZone': 'string'}}

Registers the specified targets with the specified target group.

By default, the load balancer routes requests to registered targets using the protocol and port number for the target group. Alternatively, you can override the port for a target when you register it.

The target must be in the virtual private cloud (VPC) that you specified for the target group. If the target is an EC2 instance, it must be in the running state when you register it.

To remove a target from a target group, use DeregisterTargets.

See also: AWS API Documentation

Request Syntax

client.register_targets(
    TargetGroupArn='string',
    Targets=[
        {
            'Id': 'string',
            'Port': 123,
            'AvailabilityZone': 'string'
        },
    ]
)
type TargetGroupArn

string

param TargetGroupArn

[REQUIRED]

The Amazon Resource Name (ARN) of the target group.

type Targets

list

param Targets

[REQUIRED]

The targets. The default port for a target is the port for the target group. You can specify a port override. If a target is already registered, you can register it again using a different port.

  • (dict) --

    Information about a target.

    • Id (string) -- [REQUIRED]

      The ID of the target. If the target type of the target group is instance , specify an instance ID. If the target type is ip , specify an IP address.

    • Port (integer) --

      The port on which the target is listening.

    • AvailabilityZone (string) --

      The Availability Zone where the IP address is to be registered. Specify all to register an IP address outside the target group VPC with all Availability Zones that are enabled for the load balancer.

      If the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional.

      This parameter is not supported if the target type of the target group is instance .

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --