How to Use AWS Forecast for Demand Prediction

Accurate demand forecasting can make the difference between profitable operations and costly inventory imbalances, overstaffing, or missed revenue opportunities. Amazon Web Services Forecast brings the same machine learning technology Amazon uses for its own demand prediction to businesses of all sizes, eliminating the need for deep data science expertise while delivering sophisticated time-series forecasting capabilities. Whether you’re predicting product demand, forecasting server capacity needs, or estimating energy consumption, AWS Forecast automates much of the complexity that traditionally made forecasting challenging—from selecting appropriate algorithms to handling missing data to incorporating external factors like holidays and weather. This guide provides a practical walkthrough of using AWS Forecast for demand prediction, covering everything from data preparation to model training to production deployment, with real-world examples and best practices that will help you generate accurate forecasts quickly.

Understanding AWS Forecast Capabilities

Before diving into implementation, understanding what AWS Forecast can and cannot do helps set appropriate expectations and guides proper use.

Automated machine learning forms the core of AWS Forecast’s value proposition. The service automatically tests multiple forecasting algorithms—from classical statistical methods like ARIMA and ETS to modern deep learning approaches like DeepAR+ and CNN-QR—then selects the best performer for your specific data. This automation eliminates the trial-and-error typically required to find optimal algorithms, dramatically reducing the time from data to predictions.

Built-in algorithm options include several sophisticated approaches optimized for different scenarios. DeepAR+ excels with large datasets containing hundreds or thousands of related time series, learning patterns across all series to improve individual forecasts. CNN-QR (Convolutional Neural Network – Quantile Regression) works well for datasets with irregularities and missing values. Prophet handles data with strong seasonal patterns and trend changes. ARIMA and ETS serve as classical statistical baselines that often perform well on simpler datasets.

The service handles missing data gracefully, a common real-world challenge that often derails forecasting projects. AWS Forecast uses algorithms designed to work with incomplete time series, filling gaps intelligently rather than requiring perfect data. This robustness proves invaluable when dealing with sensor failures, delayed reporting, or inconsistent data collection.

Related time series support allows you to improve forecasts by incorporating additional data. Predicting retail demand? Include pricing data, promotional schedules, and competitor information. Forecasting server load? Add user activity metrics, deployment schedules, and marketing campaign data. AWS Forecast learns relationships between your target metric and these related factors, producing more accurate predictions than using historical demand alone.

Item metadata enables the service to learn from similar items even when individual items have limited history. If you’re launching a new product with no sales history, AWS Forecast can leverage patterns from similar products—same category, similar price point, comparable seasonality—to generate informed predictions. This cold-start capability proves crucial for businesses with high product turnover or expanding inventories.

However, AWS Forecast has limitations worth understanding upfront. It’s designed for time-series forecasting, not general predictive analytics. You can’t use it for classification problems, one-off predictions unrelated to time, or causal inference. The service works best with regular time intervals (hourly, daily, weekly) and struggles with highly irregular data collection patterns. Maximum forecast horizon is 500 time points—you can’t forecast years ahead at daily granularity within a single forecast.

Preparing Your Data for AWS Forecast

Data preparation determines forecasting success more than algorithm selection. AWS Forecast requires data in specific formats, and quality preparation dramatically improves accuracy.

Target Time Series Data

The target time series contains the historical values you want to forecast—sales quantities, server CPU usage, energy consumption, or any metric varying over time. AWS Forecast requires this data in a specific CSV format with three mandatory columns:

timestamp,item_id,target_value
2024-01-01,product_001,150
2024-01-01,product_002,220
2024-01-02,product_001,165
2024-01-02,product_002,195

Timestamp must follow ISO 8601 format. The granularity determines your forecasting resolution—hourly timestamps enable hourly forecasts, daily timestamps produce daily forecasts. Choose granularity matching your business needs, but remember finer granularity requires more data points for reliable patterns.

Item_id identifies what you’re forecasting. For retail, each product SKU is an item. For capacity planning, each server or service is an item. For financial forecasting, each account or cost center is an item. AWS Forecast trains across all items simultaneously, learning shared patterns that improve individual forecasts.

Target_value is the metric you’re predicting. Keep this numeric and consistent in scale. If forecasting sales, use consistent units (don’t mix individual units and bulk package counts). For metrics spanning orders of magnitude, consider log transformation to improve model performance.

Data frequency and completeness impact accuracy significantly. Ideally, provide regular observations at your chosen granularity. If forecasting daily, include a value for every day. Missing occasional data points is acceptable—AWS Forecast handles gaps—but systemic missingness (always missing weekends, or only recording when values exceed thresholds) confuses models.

Historical data volume requirements depend on complexity. For simple patterns, a few months of daily data might suffice. For seasonal patterns, you need at least two full seasonal cycles—two years for annual seasonality, two years of weekly data for weekly patterns. DeepAR+ benefits from having many related items (hundreds or thousands), while statistical methods work with fewer items if each has substantial history.

Related Time Series Data (Optional but Powerful)

Related time series include factors that influence your target metric but aren’t the metric itself. For retail demand forecasting, related series might include:

timestamp,item_id,price,promotion_flag,competitor_price
2024-01-01,product_001,29.99,1,31.99
2024-01-01,product_002,49.99,0,47.99

These additional features help models understand demand drivers. Price changes, promotional periods, weather conditions, web traffic, economic indicators, or any time-varying factor that affects your target metric can improve accuracy.

Related time series must cover the forecast horizon. Unlike target time series that only need historical values, related series must include values for future time points you’re forecasting. If forecasting 30 days ahead, you need 30 days of future values for all related series. This requirement makes sense—if price influences demand, the model needs future prices to predict future demand. For some features like promotions, you know future values from marketing calendars. For others like weather, use separate forecasts as inputs.

Item Metadata (Optional but Valuable)

Item metadata describes characteristics of items that don’t change over time:

item_id,category,brand,color,launch_date
product_001,electronics,BrandA,black,2023-01-15
product_002,electronics,BrandB,white,2023-03-20

This metadata enables AWS Forecast to learn patterns associated with attributes. Electronics might have different seasonality than clothing. Certain brands might respond differently to promotions. Items launched recently might follow different trajectories than mature products. The service uses this metadata to improve forecasts for items with limited history by learning from similar items.

📊 AWS Forecast Data Types

🎯
Target Time Series
Required: Yes
Contains: Historical values to forecast
Columns: timestamp, item_id, value
Example: Daily sales per product
📈
Related Time Series
Required: No
Contains: Factors influencing target
Columns: timestamp, item_id, features
Example: Price, promotions, weather
🏷️
Item Metadata
Required: No
Contains: Static item attributes
Columns: item_id, attributes
Example: Category, brand, color

Creating a Dataset Group and Importing Data

With prepared data, you’re ready to create your first forecast project in AWS Forecast.

Setting Up the Dataset Group

A dataset group serves as a container for all related datasets (target time series, related time series, item metadata) and the predictors you’ll create. Think of it as a project workspace for a specific forecasting problem.

Using the AWS Console, navigate to AWS Forecast and create a new dataset group. Specify the forecasting domain—Retail for demand forecasting, Inventory Planning for stock optimization, or Custom for other use cases. The domain provides sensible defaults and domain-specific features but doesn’t fundamentally limit what you can forecast.

Set the forecasting frequency carefully—this determines the granularity of predictions. Daily frequency means daily forecasts, hourly means hourly predictions. You cannot change this after creation, so choose appropriately. Consider business needs (do you need hourly precision or daily suffices?) and data availability (do you have enough data points for reliable hourly patterns?).

Importing the Target Time Series

Create a dataset within your dataset group specifying the schema for your target time series. The schema defines column names and types:

{
  "Attributes": [
    {
      "AttributeName": "timestamp",
      "AttributeType": "timestamp"
    },
    {
      "AttributeName": "item_id",
      "AttributeType": "string"
    },
    {
      "AttributeName": "demand",
      "AttributeType": "float"
    }
  ]
}

Upload your CSV file to Amazon S3, then create a dataset import job pointing to this S3 location. AWS Forecast validates your data during import, checking format compliance and identifying issues like missing timestamps or invalid values. The import job status shows progress and any errors encountered.

Common import errors include timestamp format mismatches (ensure ISO 8601 format), non-numeric target values, duplicate timestamp-item combinations (each item should have at most one value per timestamp), and CSV formatting issues. The error messages usually pinpoint problems clearly.

Adding Related Time Series and Metadata

If you have related time series or item metadata, import them using similar processes. Create datasets with appropriate schemas, upload CSV files to S3, and launch import jobs.

Related time series schema includes your timestamp, item_id, and additional feature columns:

{
  "Attributes": [
    {
      "AttributeName": "timestamp",
      "AttributeType": "timestamp"
    },
    {
      "AttributeName": "item_id",
      "AttributeType": "string"
    },
    {
      "AttributeName": "price",
      "AttributeType": "float"
    },
    {
      "AttributeName": "promotion",
      "AttributeType": "integer"
    }
  ]
}

Remember, related time series must include future values covering your forecast horizon.

Training a Predictor

With data imported, you’re ready to train a predictor—AWS Forecast’s term for a trained forecasting model.

Configuring the Predictor

Create a predictor through the console or API. Key configuration decisions include:

Forecast horizon specifies how many time points ahead you want to predict. For daily data forecasting 30 days ahead, set horizon to 30. For hourly data forecasting one week (168 hours), set horizon to 168. Choose horizons matching business planning needs—inventory replenishment cycles, capacity planning periods, or promotional planning windows.

Forecast frequency must match your dataset frequency. If you imported daily data, forecast frequency must be daily. This cannot differ from your dataset group’s base frequency.

Algorithm selection can be automatic (AutoML) or manual. AutoML is strongly recommended for most users—AWS Forecast trains multiple algorithms and selects the best performer based on your data. This typically produces better results than manual selection unless you have specific algorithmic requirements or constraints.

Forecast quantiles determine the range of predictions. The default p50 (median) provides the most likely outcome. Adding p10 and p90 gives lower and upper bounds, useful for risk assessment and scenario planning. For inventory management, p90 forecasts help avoid stockouts by planning for higher-than-expected demand. For capacity planning, p90 ensures adequate resources for demand spikes.

Optimize on metric determines what AWS Forecast optimizes for. Options include:

  • Weighted Quantile Loss (wQL): Balanced approach, recommended default
  • Mean Absolute Percentage Error (MAPE): Good when relative errors matter more than absolute
  • Root Mean Square Error (RMSE): Penalizes large errors heavily
  • Weighted Absolute Percentage Error (WAPE): Robust to zero values in data

For most demand forecasting, wQL provides good balance. Choose WAPE if your data contains many zeros (intermittent demand).

Training Process and Duration

Training time varies from 30 minutes to several hours depending on data volume, number of items, and algorithms tested. AutoML takes longer than single-algorithm training because it tests multiple approaches. You can monitor progress in the console—AWS Forecast shows which algorithms are being evaluated and their preliminary performance.

During training, AWS Forecast:

  1. Splits your data into training and validation sets
  2. Trains multiple algorithm configurations
  3. Validates each on held-out data
  4. Selects the best-performing algorithm
  5. Trains the final model on all available data

This automated process eliminates manual hyperparameter tuning and cross-validation, delivering optimized models without requiring machine learning expertise.

Evaluating Predictor Performance

Once training completes, predictor metrics show forecast accuracy. AWS Forecast provides metrics both overall and per item, helping identify which items forecast well and which might need attention.

Key metrics to examine:

  • Weighted Quantile Loss (wQL): Lower is better. Values under 0.3 generally indicate good performance. Compare to baseline to see improvement over naive forecasts.
  • Root Mean Square Error (RMSE): Absolute error in same units as target metric. Directly interpretable—if forecasting sales in units and RMSE is 50, expect average error around 50 units.
  • Coverage: Percentage of actual values falling within prediction intervals. For p10 to p90 forecasts, expect roughly 80% coverage if calibrated correctly.

Per-item metrics reveal which items forecast accurately and which struggle. Items with limited history, high volatility, or unique patterns might show poor metrics. Consider excluding these from automated decisions or gathering more data.

Compare your model’s performance to a baseline forecast to quantify improvement. AWS Forecast provides a seasonal naive baseline—a simple forecast using the same value from the previous season. Your trained model should significantly outperform this baseline; if not, you might have data quality issues or need different features.

🔄 AWS Forecast Workflow

1
Create Dataset Group
Define forecasting domain and frequency
2
Import Data
Upload target time series, related series, and metadata
3
Train Predictor
Configure settings and let AutoML find best algorithm
4
Evaluate Performance
Review accuracy metrics and per-item performance
5
Generate Forecasts
Create forecast for specific time range
6
Export & Use Forecasts
Download results or query via API for applications

Generating and Using Forecasts

With a trained predictor, you can generate forecasts for your specific time range and items.

Creating a Forecast

Create a forecast by specifying which predictor to use and optionally filtering to specific items. By default, AWS Forecast generates predictions for all items in your dataset, but you can limit to subsets if needed—perhaps only forecasting your top-selling products or specific geographic regions.

The forecast generation process typically completes in minutes to an hour depending on the number of items and forecast horizon length. AWS Forecast computes predictions for your entire forecast horizon for all requested items.

Querying Forecast Results

Query forecasts through the console for exploration or programmatically for integration with business systems. The console provides visualization of forecasts alongside historical data, helping validate that predictions look reasonable.

Programmatic access through the AWS SDK enables integration with downstream systems:

import boto3

forecast_query = boto3.client('forecastquery')

response = forecast_query.query_forecast(
    ForecastArn='arn:aws:forecast:region:account:forecast/forecast-name',
    Filters={
        'item_id': 'product_001'
    }
)

predictions = response['Forecast']['Predictions']

# predictions contains time series of forecast values
for quantile_name, forecasts in predictions.items():
    print(f"{quantile_name}:")
    for forecast_point in forecasts:
        print(f"  {forecast_point['Timestamp']}: {forecast_point['Value']}")

This returns forecast values for specified items across your forecast horizon. The response includes predictions at configured quantiles (p10, p50, p90), enabling scenario planning.

Exporting Forecasts

For bulk access or offline analysis, export forecasts to Amazon S3:

forecast = boto3.client('forecast')

forecast.create_forecast_export_job(
    ForecastExportJobName='demand-forecast-export',
    ForecastArn='arn:aws:forecast:region:account:forecast/forecast-name',
    Destination={
        'S3Config': {
            'Path': 's3://your-bucket/forecast-exports/',
            'RoleArn': 'arn:aws:iam::account:role/ForecastS3AccessRole'
        }
    }
)

The export contains CSV files with forecasts for all items, easily imported into data warehouses, business intelligence tools, or planning systems.

Integrating Forecasts into Business Processes

Generating accurate forecasts is only valuable if they inform business decisions.

Automating Forecast Updates

Production demand forecasting requires regular updates as new data arrives. Implement automation using AWS Lambda or Step Functions to:

  1. Trigger daily/weekly after new sales data lands in your data warehouse
  2. Export latest data to S3 in AWS Forecast format
  3. Create dataset import job with new data
  4. Train new predictor with updated data
  5. Generate fresh forecasts
  6. Export results to business systems

This automation ensures forecasts stay current without manual intervention. Consider retraining frequency based on how quickly patterns change—fast-moving consumer goods might need daily updates, while industrial equipment forecasting might update weekly.

Combining with Business Rules

Pure statistical forecasts often need adjustment for business context. Integrate forecast outputs with business rules:

  • Apply minimum order quantities and lot size constraints
  • Respect capacity limits for production or warehousing
  • Incorporate promotional plans that forecasts can’t predict
  • Apply safety stock policies based on forecast uncertainty (use p90 forecasts)
  • Override forecasts for new product launches or discontinuations

Build these rules into downstream systems consuming forecast outputs rather than trying to encode them in AWS Forecast itself.

Monitoring Forecast Accuracy

Track actual outcomes against predictions to measure forecast value and identify degradation. Calculate metrics like:

  • Mean Absolute Percentage Error (MAPE): Average percentage deviation from actuals
  • Bias: Are forecasts consistently over or under-predicting?
  • Forecast value added: How much better are ML forecasts than naive baselines?

If accuracy degrades significantly, investigate causes—has the business changed? Are there new patterns? Is data quality declining? Use insights to improve data collection, add relevant features, or adjust forecast methodology.

Optimizing Forecast Performance

Initial forecasts provide a baseline; optimization improves accuracy and value.

Feature Engineering for Related Time Series

Adding relevant features to related time series often yields the biggest accuracy improvements. Consider:

Promotional indicators: Binary flags or percentage discounts for items on promotion. Promotions dramatically affect demand but aren’t reflected in historical demand alone.

Pricing data: Current and historical pricing helps models understand price elasticity. Include both your prices and competitors’ if available.

External factors: Weather affects many demand categories (cold weather → heating fuel, hot weather → beverages). Economic indicators influence discretionary purchases. Stock market movements impact financial services demand.

Event calendars: Holidays, sporting events, concerts, or conferences near your business locations. These discrete events cause demand spikes models can learn to anticipate.

The key is making these features available for future time periods. You can’t include features you won’t know during the forecast horizon.

Handling Special Cases

Intermittent demand—items with many zero-sale periods interspersed with occasional purchases—challenges most algorithms. For these items:

  • Consider NPTS (Non-Parametric Time Series) algorithm specifically designed for intermittent demand
  • Aggregate to longer time periods to reduce zeros (weekly instead of daily)
  • Use item metadata to borrow strength from similar items

New product launches with zero history require leveraging metadata. Create item metadata with product characteristics (category, brand, price tier) that match existing products. AWS Forecast uses these similarities to generate informed predictions.

Trend changes from business shifts (new marketing strategies, market expansion, competition) might not be captured in historical patterns. Consider:

  • Emphasizing recent data by limiting training history
  • Adding related time series capturing the change drivers
  • Using exponential smoothing algorithms that adapt quickly

Cost Optimization

AWS Forecast charges based on data points processed during training and number of forecasts generated. Optimize costs by:

Training strategically: Don’t retrain daily if weekly suffices. Evaluate whether forecast accuracy improvements justify frequent retraining costs.

Filtering items: If you have 10,000 SKUs but 80% of revenue comes from 1,000, consider forecasting only high-value items with automated processes. Use simple rules or safety stock for low-volume items.

Optimizing forecast horizons: Forecast only as far ahead as business decisions require. If you only use the next 7 days for automated replenishment, don’t generate 30-day forecasts.

Using appropriate quantiles: Generating p10, p20, …, p90 predictions costs more than just p50. Only request quantiles you actually use for decision-making.

Conclusion

AWS Forecast democratizes sophisticated demand forecasting by automating algorithm selection, handling missing data gracefully, and incorporating business context through related time series and item metadata. The service transforms time series forecasting from a complex data science problem requiring specialized expertise into an accessible tool that businesses can deploy rapidly. By following the workflow of careful data preparation, leveraging AutoML for algorithm selection, incorporating relevant features, and systematically evaluating results, organizations can generate accurate demand predictions that drive better inventory decisions, capacity planning, and resource allocation.

Success with AWS Forecast comes from treating forecasting as an iterative process rather than a one-time implementation. Start with basic target time series, establish baseline accuracy, then progressively add related features and metadata that improve predictions for your specific use case. Monitor forecast accuracy against actual outcomes, identify where forecasts struggle, and refine your approach based on these insights. The combination of AWS Forecast’s powerful algorithms and your domain knowledge about business drivers, special events, and contextual factors creates forecasts that are both statistically sound and practically useful for business operations.

Leave a Comment