add_instance_groups ( $instance_groups, $job_flow_id, $opt )

AddInstanceGroups adds an instance group to a running cluster.

Access

public

Parameters

Parameter

Type

Required

Description

$instance_groups

array

Required

Instance Groups to add.

  • x - array - Optional - This represents a simple array index.
    • Name - string - Optional - Friendly name given to the instance group. [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]*]
    • Market - string - Optional - Market type of the Amazon EC2 instances used to create a cluster node. [Allowed values: ON_DEMAND, SPOT]
    • InstanceRole - string - Required - The role of the instance group in the cluster. [Allowed values: MASTER, CORE, TASK]
    • BidPrice - string - Optional - Bid price for each Amazon EC2 instance in the instance group when launching nodes as Spot Instances, expressed in USD. [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]*]
    • InstanceType - string - Required - The Amazon EC2 instance type for all instances in the instance group. [Constraints: The value must be between 1 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 number of instances for the instance group.

$job_flow_id

string

Required

Job flow in which to add the instance groups. [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]*]

$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

Add instances to an existing Hadoop cluster.

$emr = new AmazonEMR();

$response = $emr->add_instance_groups(array(
	array( // Group #1
		'InstanceCount' => 1,
		'InstanceRole' => 'TASK',
		'InstanceType' => 'm1.small',
		'Market' => 'ON_DEMAND',
		'Name' => 'my-hadoop-task-cluster',
	)
), $jobflow_id);

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

Related Methods

Source

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

public function add_instance_groups($instance_groups, $job_flow_id, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['JobFlowId'] = $job_flow_id;
    
    // Required list + map
    $opt = array_merge($opt, CFComplexType::map(array(
        'InstanceGroups' => (is_array($instance_groups) ? $instance_groups : array($instance_groups))
    ), 'member'));

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

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback