set_instance_health ( $instance_id, $health_status, $opt )

Sets the health status of an instance.

Access

public

Parameters

Parameter

Type

Required

Description

$instance_id

string

Required

The identifier of the Amazon EC2 instance. [Constraints: The value must be between 1 and 16 characters, and must match the following regular expression pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*]

$health_status

string

Required

The health status of the instance. “Healthy” means that the instance is healthy and should remain in service. “Unhealthy” means that the instance is unhealthy. Auto Scaling should terminate and replace it. [Constraints: The value must be between 1 and 32 characters, and must match the following regular expression pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*]

$opt

array

Optional

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

  • ShouldRespectGracePeriod - boolean - Optional - If True, this call should respect the grace period associated with the group.
  • 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

Set the instance health for an autoscaling group.

// Instantiate the class
$as = new AmazonAS();

$response = $as->set_instance_health('i-be038dd3', 'Unhealthy', array(
	'ShouldRespectGracePeriod' => 'false'
));

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

Related Methods

Source

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

public function set_instance_health($instance_id, $health_status, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['InstanceId'] = $instance_id;
    $opt['HealthStatus'] = $health_status;
    
    return $this->authenticate('SetInstanceHealth', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback