Skip to content

EC2  >  Operations  >  purchase_host_reservation

purchase_host_reservation

Operation

purchase_host_reservation async

purchase_host_reservation(request: PurchaseHostReservationInput | PurchaseHostReservationInputDict, /, *, plugins: list[Plugin] | None = None) -> PurchaseHostReservationOutput
purchase_host_reservation(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[PurchaseHostReservationInputDict]) -> PurchaseHostReservationOutput

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.

Parameters:

Name Type Description Default
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
PurchaseHostReservationOutput

An instance of PurchaseHostReservationOutput.

Input

Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.

Model

PurchaseHostReservationInput dataclass

Bases: _SerdeShape

Dataclass for PurchaseHostReservationInput structure.

Attributes
client_token class-attribute instance-attribute
client_token: str | None = ...

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.

currency_code class-attribute instance-attribute
currency_code: str | None = ...

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

host_id_set class-attribute instance-attribute
host_id_set: list[str] | None = ...

The IDs of the Dedicated Hosts with which the reservation will be associated.

limit_price class-attribute instance-attribute
limit_price: str | None = ...

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 fails. 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.

offering_id class-attribute instance-attribute
offering_id: str | None = ...

The ID of the offering.

tag_specifications class-attribute instance-attribute
tag_specifications: list[TagSpecification] | None = ...

The tags to apply to the Dedicated Host Reservation during purchase.

Dictionaries

PurchaseHostReservationInputDict

Bases: TypedDict

Dictionary form of PurchaseHostReservationInput.

Attributes
client_token instance-attribute
client_token: str | None

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.

currency_code instance-attribute
currency_code: str | None

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

host_id_set instance-attribute
host_id_set: Required[Sequence[str]]

The IDs of the Dedicated Hosts with which the reservation will be associated.

limit_price instance-attribute
limit_price: str | None

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 fails. 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.

offering_id instance-attribute
offering_id: Required[str]

The ID of the offering.

tag_specifications instance-attribute
tag_specifications: Sequence[TagSpecification | TagSpecificationDict] | None

The tags to apply to the Dedicated Host Reservation during purchase.

Output

PurchaseHostReservationOutput dataclass

Bases: _SerdeShape

Dataclass for PurchaseHostReservationOutput structure.

Attributes

client_token class-attribute instance-attribute
client_token: str | None = ...

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.

currency_code class-attribute instance-attribute
currency_code: str | None = ...

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

purchase class-attribute instance-attribute
purchase: list[Purchase] | None = ...

Describes the details of the purchase.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

total_hourly_price class-attribute instance-attribute
total_hourly_price: str | None = ...

The total hourly price of the reservation calculated per hour.

total_upfront_price class-attribute instance-attribute
total_upfront_price: str | None = ...

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