configure_health_check ( $load_balancer_name, $health_check, $opt )

Enables the client to define an application healthcheck for the instances.

Access

public

Parameters

Parameter

Type

Required

Description

$load_balancer_name

string

Required

The mnemonic name associated with the LoadBalancer. This name must be unique within the client AWS account.

$health_check

array

Required

A structure containing the configuration information for the new healthcheck.

  • x - array - Optional - This represents a simple array index.
    • Target - string - Required - Specifies 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 healthcheck 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 or HTTPS protocol, the situation is different. You have to 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 needs to be 1024 16-bit Unicode characters or less.

    • Interval - integer - Required - Specifies the approximate interval, in seconds, between health checks of an individual instance.
    • Timeout - integer - Required - Specifies the amount of time, in seconds, during which no response means a failed health probe.

      This value must be less than the Interval value.

    • UnhealthyThreshold - integer - Required - Specifies the number of consecutive health probe failures required before moving the instance to the Unhealthy state.
    • HealthyThreshold - integer - Required - Specifies the number of consecutive health probe successes required before moving the instance to the Healthy state.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Configure how the health of a load balancer is defined.

$elb = new AmazonELB();

$response = $elb->configure_health_check('my-load-balancer', array(
	array( // Healthcheck #1
		'HealthyThreshold' => 3,
		'Interval' => 30,
		'Target' => 'TCP:5000',
		'Timeout' => 5,
		'UnhealthyThreshold' => 5
	)
));

// Success?
var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/elb.class.php | Toggle source view (12 lines) | View on GitHub

public function configure_health_check($load_balancer_name, $health_check, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['LoadBalancerName'] = $load_balancer_name;
    
    // Required map (non-list)
    $opt = array_merge($opt, CFComplexType::map(array(
        'HealthCheck' => (is_array($health_check) ? $health_check : array($health_check))
    ), 'member'));

    return $this->authenticate('ConfigureHealthCheck', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback