Skip to content

describe_spot_price_history async

describe_spot_price_history(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    availability_zone_id: Optional[AvailabilityZoneId] = None,
    dry_run: Optional[Boolean] = None,
    start_time: Optional[DateTime] = None,
    end_time: Optional[DateTime] = None,
    instance_types: Optional[InstanceTypeList] = None,
    product_descriptions: Optional[ProductDescriptionList] = None,
    filters: Optional[FilterList] = None,
    availability_zone: Optional[String] = None,
    max_results: Optional[Integer] = None,
    next_token: Optional[String] = None,
) -> DescribeSpotPriceHistoryResult

Describes the Spot price history. For more information, see Spot Instance pricing history in the Amazon EC2 User Guide.

When you specify a start and end time, the operation returns the prices of the instance types within that time range. It also returns the last price change before the start time, which is the effective price as of the start time.

Parameters:

  • availability_zone_id (Optional[AvailabilityZoneId], default: None ) –

    Filters the results by the specified ID of the Availability Zone.

    Either AvailabilityZone or AvailabilityZoneId can be specified, but not both

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • start_time (Optional[DateTime], default: None ) –

    The date and time, up to the past 90 days, from which to start retrieving the price history data, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ).

  • end_time (Optional[DateTime], default: None ) –

    The date and time, up to the current date, from which to stop retrieving the price history data, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ).

  • instance_types (Optional[InstanceTypeList], default: None ) –

    Filters the results by the specified instance types.

  • product_descriptions (Optional[ProductDescriptionList], default: None ) –

    Filters the results by the specified basic product descriptions.

  • filters (Optional[FilterList], default: None ) –

    The filters.

    • availability-zone - The Availability Zone for which prices should be returned.

    • availability-zone-id - The ID of the Availability Zone for which prices should be returned.

    • instance-type - The type of instance (for example, m3.medium).

    • product-description - The product description for the Spot price (Linux/UNIX | Red Hat Enterprise Linux | SUSE Linux | Windows | Linux/UNIX (Amazon VPC) | Red Hat Enterprise Linux (Amazon VPC) | SUSE Linux (Amazon VPC) | Windows (Amazon VPC)).

    • spot-price - The Spot price. The value must match exactly (or use wildcards; greater than or less than comparison is not supported).

    • timestamp - The time stamp of the Spot price history, in UTC format (for example, ddd MMM dd HH:mm:ss UTC YYYY). You can use wildcards (* and ?). Greater than or less than comparison is not supported.

  • availability_zone (Optional[String], default: None ) –

    Filters the results by the specified Availability Zone.

    Either AvailabilityZone or AvailabilityZoneId can be specified, but not both

  • max_results (Optional[Integer], default: None ) –

    The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination.

  • next_token (Optional[String], default: None ) –

    The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.

Raises:

Examples:

To describe Spot price history for Linux/UNIX (Amazon VPC) This example returns the Spot Price history for m1.xlarge, Linux/UNIX (Amazon VPC) instances for a particular day in January.

>>> await client.describe_spot_price_history(start_time='2014-01-06T07:08:09.05Z', end_time='2014-01-06T08:09:10.05Z', instance_types=['m1.xlarge'], product_descriptions=['Linux/UNIX (Amazon VPC)'])
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def describe_spot_price_history(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    availability_zone_id: Optional[
        "capo_ec2.types.availability_zone_id.AvailabilityZoneId"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    start_time: Optional["capo_ec2.types.date_time.DateTime"] = None,
    end_time: Optional["capo_ec2.types.date_time.DateTime"] = None,
    instance_types: Optional[
        "capo_ec2.types.instance_type_list.InstanceTypeList"
    ] = None,
    product_descriptions: Optional[
        "capo_ec2.types.product_description_list.ProductDescriptionList"
    ] = None,
    filters: Optional["capo_ec2.types.filter_list.FilterList"] = None,
    availability_zone: Optional["capo_ec2.types.string.String"] = None,
    max_results: Optional["capo_ec2.types.integer.Integer"] = None,
    next_token: Optional["capo_ec2.types.string.String"] = None,
) -> "capo_ec2.types.describe_spot_price_history_result.DescribeSpotPriceHistoryResult":
    """<p>Describes the Spot price history. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances-history.html">Spot Instance pricing history</a> in the <i>Amazon EC2 User Guide</i>.</p> <p>When you specify a start and end time, the operation returns the prices of the instance types within that time range. It also returns the last price change before the start time, which is the effective price as of the start time.</p>

    Args:
        availability_zone_id: <p>Filters the results by the specified ID of the Availability Zone.</p> <p>Either <code>AvailabilityZone</code> or <code>AvailabilityZoneId</code> can be specified, but not both</p>
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        start_time: <p>The date and time, up to the past 90 days, from which to start retrieving the price history data, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</p>
        end_time: <p>The date and time, up to the current date, from which to stop retrieving the price history data, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</p>
        instance_types: <p>Filters the results by the specified instance types.</p>
        product_descriptions: <p>Filters the results by the specified basic product descriptions.</p>
        filters: <p>The filters.</p> <ul> <li> <p> <code>availability-zone</code> - The Availability Zone for which prices should be returned.</p> </li> <li> <p> <code>availability-zone-id</code> - The ID of the Availability Zone for which prices should be returned.</p> </li> <li> <p> <code>instance-type</code> - The type of instance (for example, <code>m3.medium</code>).</p> </li> <li> <p> <code>product-description</code> - The product description for the Spot price (<code>Linux/UNIX</code> | <code>Red Hat Enterprise Linux</code> | <code>SUSE Linux</code> | <code>Windows</code> | <code>Linux/UNIX (Amazon VPC)</code> | <code>Red Hat Enterprise Linux (Amazon VPC)</code> | <code>SUSE Linux (Amazon VPC)</code> | <code>Windows (Amazon VPC)</code>).</p> </li> <li> <p> <code>spot-price</code> - The Spot price. The value must match exactly (or use wildcards; greater than or less than comparison is not supported).</p> </li> <li> <p> <code>timestamp</code> - The time stamp of the Spot price history, in UTC format (for example, <i>ddd MMM dd HH</i>:<i>mm</i>:<i>ss</i> UTC <i>YYYY</i>). You can use wildcards (<code>*</code> and <code>?</code>). Greater than or less than comparison is not supported.</p> </li> </ul>
        availability_zone: <p>Filters the results by the specified Availability Zone.</p> <p>Either <code>AvailabilityZone</code> or <code>AvailabilityZoneId</code> can be specified, but not both</p>
        max_results: <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
        next_token: <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To describe Spot price history for Linux/UNIX (Amazon VPC)
        This example returns the Spot Price history for m1.xlarge, Linux/UNIX (Amazon VPC) instances for a particular day in January.

        >>> await client.describe_spot_price_history(start_time='2014-01-06T07:08:09.05Z', end_time='2014-01-06T08:09:10.05Z', instance_types=['m1.xlarge'], product_descriptions=['Linux/UNIX (Amazon VPC)'])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.describe_spot_price_history_request.DescribeSpotPriceHistoryRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.describe_spot_price_history_result.DescribeSpotPriceHistoryResult"
    ]:
        import capo_ec2._operations.amazon_ec2.describe_spot_price_history

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.describe_spot_price_history.async_describe_spot_price_history(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeSpotPriceHistory")
    )
    input_: capo_ec2.types.describe_spot_price_history_request.DescribeSpotPriceHistoryRequest = {}
    if availability_zone_id is not None:
        input_["availability_zone_id"] = availability_zone_id
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if start_time is not None:
        input_["start_time"] = start_time
    if end_time is not None:
        input_["end_time"] = end_time
    if instance_types is not None:
        input_["instance_types"] = instance_types
    if product_descriptions is not None:
        input_["product_descriptions"] = product_descriptions
    if filters is not None:
        input_["filters"] = filters
    if availability_zone is not None:
        input_["availability_zone"] = availability_zone
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output