Skip to content

get_reservation_purchase_recommendation async

get_reservation_purchase_recommendation(
    service: GenericString,
    *,
    config_overrides: Optional[AsyncCostExplorerClientConfig] = None,
    account_id: Optional[GenericString] = None,
    filter: Optional[Expression] = None,
    account_scope: Optional[AccountScope] = None,
    lookback_period_in_days: Optional[LookbackPeriodInDays] = None,
    term_in_years: Optional[TermInYears] = None,
    payment_option: Optional[PaymentOption] = None,
    service_specification: Optional[ServiceSpecification] = None,
    page_size: Optional[RecommendationsPageSize] = None,
    next_page_token: Optional[NextPageToken] = None,
) -> GetReservationPurchaseRecommendationResponse

Gets recommendations for reservation purchases. These recommendations might help you to reduce your costs. Reservations provide a discounted hourly rate (up to 75%) compared to On-Demand pricing.

Amazon Web Services generates your recommendations by identifying your On-Demand usage during a specific time period and collecting your usage into categories that are eligible for a reservation. After Amazon Web Services has these categories, it simulates every combination of reservations in each category of usage to identify the best number of each type of Reserved Instance (RI) to purchase to maximize your estimated savings.

For example, Amazon Web Services automatically aggregates your Amazon EC2 Linux, shared tenancy, and c4 family usage in the US West (Oregon) Region and recommends that you buy size-flexible regional reservations to apply to the c4 family usage. Amazon Web Services recommends the smallest size instance in an instance family. This makes it easier to purchase a size-flexible Reserved Instance (RI). Amazon Web Services also shows the equal number of normalized units. This way, you can purchase any instance size that you want. For this example, your RI recommendation is for c4.large because that is the smallest size instance in the c4 instance family.

Parameters:

  • account_id (Optional[GenericString], default: None ) –

    The account ID that's associated with the recommendation.

  • service (GenericString) –

    The specific service that you want recommendations for.

  • account_scope (Optional[AccountScope], default: None ) –

    The account scope that you want your recommendations for. Amazon Web Services calculates recommendations including the management account and member accounts if the value is set to PAYER. If the value is LINKED, recommendations are calculated for individual member accounts only.

  • lookback_period_in_days (Optional[LookbackPeriodInDays], default: None ) –

    The number of previous days that you want Amazon Web Services to consider when it calculates your recommendations.

  • term_in_years (Optional[TermInYears], default: None ) –

    The reservation term that you want recommendations for.

  • payment_option (Optional[PaymentOption], default: None ) –

    The reservation purchase option that you want recommendations for.

  • service_specification (Optional[ServiceSpecification], default: None ) –

    The hardware specifications for the service instances that you want recommendations for, such as standard or convertible Amazon EC2 instances.

  • page_size (Optional[RecommendationsPageSize], default: None ) –

    The number of recommendations that you want returned in a single response object.

  • next_page_token (Optional[NextPageToken], default: None ) –

    The pagination token that indicates the next set of results that you want to retrieve.

Raises:

Source code in docs_src/capo_cost_explorer/_services/async_cost_explorer.py
async def get_reservation_purchase_recommendation(
    self,
    service: "capo_cost_explorer.types.generic_string.GenericString",
    *,
    config_overrides: Optional[AsyncCostExplorerClientConfig] = None,
    account_id: Optional[
        "capo_cost_explorer.types.generic_string.GenericString"
    ] = None,
    filter: Optional["capo_cost_explorer.types.expression.Expression"] = None,
    account_scope: Optional[
        "capo_cost_explorer.types.account_scope.AccountScope"
    ] = None,
    lookback_period_in_days: Optional[
        "capo_cost_explorer.types.lookback_period_in_days.LookbackPeriodInDays"
    ] = None,
    term_in_years: Optional[
        "capo_cost_explorer.types.term_in_years.TermInYears"
    ] = None,
    payment_option: Optional[
        "capo_cost_explorer.types.payment_option.PaymentOption"
    ] = None,
    service_specification: Optional[
        "capo_cost_explorer.types.service_specification.ServiceSpecification"
    ] = None,
    page_size: Optional[
        "capo_cost_explorer.types.recommendations_page_size.RecommendationsPageSize"
    ] = None,
    next_page_token: Optional[
        "capo_cost_explorer.types.next_page_token.NextPageToken"
    ] = None,
) -> "capo_cost_explorer.types.get_reservation_purchase_recommendation_response.GetReservationPurchaseRecommendationResponse":
    """<p>Gets recommendations for reservation purchases. These recommendations might help you to reduce your costs. Reservations provide a discounted hourly rate (up to 75%) compared to On-Demand pricing.</p> <p>Amazon Web Services generates your recommendations by identifying your On-Demand usage during a specific time period and collecting your usage into categories that are eligible for a reservation. After Amazon Web Services has these categories, it simulates every combination of reservations in each category of usage to identify the best number of each type of Reserved Instance (RI) to purchase to maximize your estimated savings. </p> <p>For example, Amazon Web Services automatically aggregates your Amazon EC2 Linux, shared tenancy, and c4 family usage in the US West (Oregon) Region and recommends that you buy size-flexible regional reservations to apply to the c4 family usage. Amazon Web Services recommends the smallest size instance in an instance family. This makes it easier to purchase a size-flexible Reserved Instance (RI). Amazon Web Services also shows the equal number of normalized units. This way, you can purchase any instance size that you want. For this example, your RI recommendation is for <code>c4.large</code> because that is the smallest size instance in the c4 instance family.</p>

    Args:
        account_id: <p>The account ID that's associated with the recommendation. </p>
        service: <p>The specific service that you want recommendations for.</p>
        account_scope: <p>The account scope that you want your recommendations for. Amazon Web Services calculates recommendations including the management account and member accounts if the value is set to <code>PAYER</code>. If the value is <code>LINKED</code>, recommendations are calculated for individual member accounts only.</p>
        lookback_period_in_days: <p>The number of previous days that you want Amazon Web Services to consider when it calculates your recommendations.</p>
        term_in_years: <p>The reservation term that you want recommendations for.</p>
        payment_option: <p>The reservation purchase option that you want recommendations for.</p>
        service_specification: <p>The hardware specifications for the service instances that you want recommendations for, such as standard or convertible Amazon EC2 instances.</p>
        page_size: <p>The number of recommendations that you want returned in a single response object.</p>
        next_page_token: <p>The pagination token that indicates the next set of results that you want to retrieve.</p>

    Raises:
        capo_cost_explorer.errors.data_unavailable_exception.DataUnavailableException: <p>The requested data is unavailable.</p>
        capo_cost_explorer.errors.invalid_next_token_exception.InvalidNextTokenException: <p>The pagination token is invalid. Try again without a pagination token.</p>
        capo_cost_explorer.errors.limit_exceeded_exception.LimitExceededException: <p>You made too many calls in a short period of time. Try again later.</p>
        capo_cost_explorer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cost_explorer.types.get_reservation_purchase_recommendation_request.GetReservationPurchaseRecommendationRequest]",
    ) -> AsyncOperationResponse[
        "capo_cost_explorer.types.get_reservation_purchase_recommendation_response.GetReservationPurchaseRecommendationResponse"
    ]:
        import capo_cost_explorer._operations.aws_insights_index_service.get_reservation_purchase_recommendation

        (
            output,
            http_response,
        ) = await capo_cost_explorer._operations.aws_insights_index_service.get_reservation_purchase_recommendation.async_get_reservation_purchase_recommendation(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetReservationPurchaseRecommendation")
    )
    input_: capo_cost_explorer.types.get_reservation_purchase_recommendation_request.GetReservationPurchaseRecommendationRequest = {
        "service": service
    }
    if account_id is not None:
        input_["account_id"] = account_id
    if filter is not None:
        input_["filter"] = filter
    if account_scope is not None:
        input_["account_scope"] = account_scope
    if lookback_period_in_days is not None:
        input_["lookback_period_in_days"] = lookback_period_in_days
    if term_in_years is not None:
        input_["term_in_years"] = term_in_years
    if payment_option is not None:
        input_["payment_option"] = payment_option
    if service_specification is not None:
        input_["service_specification"] = service_specification
    if page_size is not None:
        input_["page_size"] = page_size
    if next_page_token is not None:
        input_["next_page_token"] = next_page_token

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