modify_instance_groups ( $opt )

ModifyInstanceGroups modifies the number of nodes and configuration settings of an instance group. The input parameters include the new target instance count for the group and the instance group ID. The call will either succeed or fail atomically.

Access

public

Parameters

Parameter

Type

Required

Description

$opt

array

Optional

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

  • InstanceGroups - array - Optional - Instance groups to change.
    • x - array - Optional - This represents a simple array index.
      • InstanceGroupId - string - Required - Unique ID of the instance group to expand or shrink. [Constraints: The value must be between 0 and 256 characters, and must match the following regular expression pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*]
      • InstanceCount - integer - Required - Target size for the instance 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

Modify the size of an existing instance group in a Hadoop cluster.

Unfortunately, there’s no easy way to get the InstanceGroupId. We’ll need to do some queries to to get the data we need.

$emr = new AmazonEMR();

// Look up the data for our job flow
$description = $emr->describe_job_flows(array(
	'JobFlowIds' => 'j-2PL8AAY8YJ06P'
));

// Query the response with an XPath expression to get the InstanceGroupId
$instance_group_id = $description->body
	->query('descendant-or-self::InstanceGroups/member[Name = "my-hadoop-task-cluster"]/InstanceGroupId')
	->first()
	->to_string();

$response = $emr->modify_instance_groups(array(
	'InstanceGroups' => array(
		array(
			'InstanceGroupId' => $instance_group_id,
			'InstanceCount' => 2
		)
	)
));

// Success?
var_dump($response->isOK());

Related Methods

Source

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

public function modify_instance_groups($opt = null)
{
    if (!$opt) $opt = array();
            
    // Optional list + map
    if (isset($opt['InstanceGroups']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'InstanceGroups' => $opt['InstanceGroups']
        ), 'member'));
        unset($opt['InstanceGroups']);
    }

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

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback