Skip to content

GetPredictiveScalingForecast

Source: src/AWS/ApplicationAutoScaling/GetPredictiveScalingForecast.ts

Runtime binding for the GetPredictiveScalingForecast operation (IAM action application-autoscaling:GetPredictiveScalingForecast).

Retrieves the load and capacity forecast a predictive scaling policy has computed for a time window (forecasts are created from at least 24 hours of historical CloudWatch data). The bound policy must be a PredictiveScaling policy on an ECS service: the API rejects other policy types with the typed ValidationException and namespaces without predictive scaling support with the typed PredictiveScalingForecastNotSupported. Provide the implementation with Effect.provide(AWS.ApplicationAutoScaling.GetPredictiveScalingForecastHttp).

// init — bind the operation to the predictive scaling policy
const getPredictiveScalingForecast =
yield* AWS.ApplicationAutoScaling.GetPredictiveScalingForecast(policy);
// runtime — read the forecast window
const now = yield* Effect.sync(() => Date.now());
const forecast = yield* getPredictiveScalingForecast({
StartTime: new Date(now),
EndTime: new Date(now + 48 * 60 * 60 * 1000),
});
const capacity = forecast.CapacityForecast?.Values ?? [];