purchase_reserved_instances_offering ( $reserved_instances_offering_id, $instance_count, $opt )

The PurchaseReservedInstancesOffering operation purchases a Reserved Instance for use with your account. With Amazon EC2 Reserved Instances, you purchase the right to launch Amazon EC2 instances for a period of time (without getting insufficient capacity errors) and pay a lower usage rate for the actual time used.

Access

public

Parameters

Parameter

Type

Required

Description

$reserved_instances_offering_id

string

Required

The unique ID of the Reserved Instances offering being purchased.

$instance_count

integer

Required

The number of Reserved Instances to purchase.

$opt

array

Optional

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

  • LimitPrice - array - Optional -
    • x - array - Optional - This represents a simple array index.
      • Amount - double - Optional -
      • CurrencyCode - string - Optional -
  • 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

Purchase a reserved instances offering.

// Instantiate the class
$ec2 = new AmazonEC2();

$response = $ec2->purchase_reserved_instances_offering('438012d3-352b-4361-9d2e-a3166db861b1', 1);

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

Related Methods

Source

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

public function purchase_reserved_instances_offering($reserved_instances_offering_id, $instance_count, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['ReservedInstancesOfferingId'] = $reserved_instances_offering_id;
    $opt['InstanceCount'] = $instance_count;
    
    // Optional map (non-list)
    if (isset($opt['LimitPrice']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'LimitPrice' => $opt['LimitPrice']
        )));
        unset($opt['LimitPrice']);
    }

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

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback