Menu
Amazon Elastic Compute Cloud
API Reference (API Version 2016-11-15)

PurchaseHostReservation

Purchase a reservation with configurations that match those of your Dedicated Host. You must have active Dedicated Hosts in your account before you purchase a reservation. This action results in the specified reservation being purchased and charged to your account.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.

ClientToken

Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see How to Ensure Idempotency in the Amazon Elastic Compute Cloud User Guide.

Type: String

Required: No

CurrencyCode

The currency in which the totalUpfrontPrice, LimitPrice, and totalHourlyPrice amounts are specified. At this time, the only supported currency is USD.

Type: String

Valid Values: USD

Required: No

HostIdSet.N

The ID/s of the Dedicated Host/s that the reservation will be associated with.

Type: array of Strings

Required: Yes

LimitPrice

The specified limit is checked against the total upfront cost of the reservation (calculated as the offering's upfront cost multiplied by the host count). If the total upfront cost is greater than the specified price limit, the request will fail. This is used to ensure that the purchase does not exceed the expected upfront cost of the purchase. At this time, the only supported currency is USD. For example, to indicate a limit price of USD 100, specify 100.00.

Type: String

Required: No

OfferingId

The ID of the offering.

Type: String

Required: Yes

Response Elements

The following elements are returned by the service.

clientToken

Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see How to Ensure Idempotency in the Amazon Elastic Compute Cloud User Guide

Type: String

currencyCode

The currency in which the totalUpfrontPrice and totalHourlyPrice amounts are specified. At this time, the only supported currency is USD.

Type: String

Valid Values: USD

purchase

Describes the details of the purchase.

Type: array of Purchase objects

requestId

The ID of the request.

Type: String

totalHourlyPrice

The total hourly price of the reservation calculated per hour.

Type: String

totalUpfrontPrice

The total amount that will be charged to your account when you purchase the reservation.

Type: String

Errors

For information about the errors that are common to all actions, see Common Errors.

Example

Example

This example uses the same configuration information from GetHostReservationPurchasePreview to make the purchase and associate the offering with the specified Dedicated Host.

Sample Request

Copy
https://ec2.amazonaws.com/?Action=PurchaseHostReservation &OfferingId=hro-0eb3541dght849c2d &HostIdSet=h-0fgr9ddb0ecd0a1cd &AUTHPARAMS

Sample Response

Copy
<PurchaseHostReservationResult xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>d4904fd9-84c3-b40d-gtyk-a9983EXAMPLE</requestId> <purchase> <item> <duration>31536000</duration> <upfrontPrice>7453.000</upfrontPrice> <paymentOption>PartialUpfront</paymentOption> <instanceFamily>m4</instanceFamily> <hourlyPrice>0.850</hourlyPrice> <hostIdSet> <item>h-0fgr9ddb0ecd0a1cd</item> </hostIdSet> </item> </purchase> <totalHourlyPrice>0.850<totalHourlyPrice> <totalUpfrontPrice>7453.000<totalUpfrontPrice> </PurchaseHostReservationResult>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: