Skip to content

get_predictive_scaling_forecast async

get_predictive_scaling_forecast(
    *,
    config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
    auto_scaling_group_name: Optional[XmlStringMaxLen255] = None,
    policy_name: Optional[XmlStringMaxLen255] = None,
    start_time: Optional[TimestampType] = None,
    end_time: Optional[TimestampType] = None,
) -> GetPredictiveScalingForecastAnswer

Retrieves the forecast data for a predictive scaling policy.

Load forecasts are predictions of the hourly load values using historical load data from CloudWatch and an analysis of historical trends. Capacity forecasts are represented as predicted values for the minimum capacity that is needed on an hourly basis, based on the hourly load forecast.

A minimum of 24 hours of data is required to create the initial forecasts. However, having a full 14 days of historical data results in more accurate forecasts.

For more information, see Predictive scaling for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.

Parameters:

  • auto_scaling_group_name (Optional[XmlStringMaxLen255], default: None ) –

    The name of the Auto Scaling group.

  • policy_name (Optional[XmlStringMaxLen255], default: None ) –

    The name of the policy.

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

    The inclusive start time of the time range for the forecast data to get. At most, the date and time can be one year before the current date and time.

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

    The exclusive end time of the time range for the forecast data to get. The maximum time duration between the start and end time is 30 days.

    Although this parameter can accept a date and time that is more than two days in the future, the availability of forecast data has limits. Amazon EC2 Auto Scaling only issues forecasts for periods of two days in advance.

Raises:

  • ResourceContentionFault –

    You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_auto_scaling/_services/async_auto_scaling.py
async def get_predictive_scaling_forecast(
    self,
    *,
    config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
    auto_scaling_group_name: Optional[
        "capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
    ] = None,
    policy_name: Optional[
        "capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
    ] = None,
    start_time: Optional[
        "capo_auto_scaling.types.timestamp_type.TimestampType"
    ] = None,
    end_time: Optional[
        "capo_auto_scaling.types.timestamp_type.TimestampType"
    ] = None,
) -> "capo_auto_scaling.types.get_predictive_scaling_forecast_answer.GetPredictiveScalingForecastAnswer":
    """<p>Retrieves the forecast data for a predictive scaling policy.</p> <p>Load forecasts are predictions of the hourly load values using historical load data from CloudWatch and an analysis of historical trends. Capacity forecasts are represented as predicted values for the minimum capacity that is needed on an hourly basis, based on the hourly load forecast.</p> <p>A minimum of 24 hours of data is required to create the initial forecasts. However, having a full 14 days of historical data results in more accurate forecasts.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-predictive-scaling.html">Predictive scaling for Amazon EC2 Auto Scaling</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>

    Args:
        auto_scaling_group_name: <p>The name of the Auto Scaling group.</p>
        policy_name: <p>The name of the policy.</p>
        start_time: <p>The inclusive start time of the time range for the forecast data to get. At most, the date and time can be one year before the current date and time.</p>
        end_time: <p>The exclusive end time of the time range for the forecast data to get. The maximum time duration between the start and end time is 30 days. </p> <p>Although this parameter can accept a date and time that is more than two days in the future, the availability of forecast data has limits. Amazon EC2 Auto Scaling only issues forecasts for periods of two days in advance.</p>

    Raises:
        capo_auto_scaling.errors.resource_contention_fault.ResourceContentionFault: <p>You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).</p>
        capo_auto_scaling.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_auto_scaling.types.get_predictive_scaling_forecast_type.GetPredictiveScalingForecastType]",
    ) -> AsyncOperationResponse[
        "capo_auto_scaling.types.get_predictive_scaling_forecast_answer.GetPredictiveScalingForecastAnswer"
    ]:
        import capo_auto_scaling._operations.auto_scaling_2011_01_01.get_predictive_scaling_forecast

        (
            output,
            http_response,
        ) = await capo_auto_scaling._operations.auto_scaling_2011_01_01.get_predictive_scaling_forecast.async_get_predictive_scaling_forecast(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetPredictiveScalingForecast")
    )
    input_: capo_auto_scaling.types.get_predictive_scaling_forecast_type.GetPredictiveScalingForecastType = {}
    if auto_scaling_group_name is not None:
        input_["auto_scaling_group_name"] = auto_scaling_group_name
    if policy_name is not None:
        input_["policy_name"] = policy_name
    if start_time is not None:
        input_["start_time"] = start_time
    if end_time is not None:
        input_["end_time"] = end_time

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