Getting Started - Amazon Forecast

Getting Started

To get started using Amazon Forecast, you do the following.

  • Create a Forecast dataset and import training data.

  • Create a Forecast predictor, which you use generate forecasts based on your time-series data. Forecast applies the optimal combination of algorithms to each time series in your datasets.

  • Generate a forecast.

In this exercise, you use a modified version of a publicly available electricity usage dataset to train a predictor. For more information, see ElectricityLoadDiagrams20112014 Data Set. The following are sample rows from the dataset:

2014-01-01 01:00:00, 2.53807106598985, client_0 2014-01-01 01:00:00, 23.648648648648624, client_1 2014-01-01 02:00:00, 9.648648648612345, client_0

For this exercise, you use the dataset to train a predictor, and then predict the hourly electricity usage by client.

You can use either the Forecast console or the AWS Command Line Interface (AWS CLI) for this exercise. Pay attention to the default regions of the Amazon Forecast console, the AWS CLI, and the Amazon Forecast SDKs, as Amazon Forecast resources are not shared across regions.


Before you begin, make sure that you have an AWS account and have installed the AWS CLI. For more information, see Setting Up. We also recommend that you review How Amazon Forecast Works.

Prepare Input Data

Regardless of whether you use the Amazon Forecast console or the AWS Command Line Interface (AWS CLI) to set up a forecasting project, you need to set up your input data. To prepare your data, you do the following:

  • Download training data to your computer and upload it to an Amazon Simple Storage Service (Amazon S3) bucket in your AWS account. To import your data to an Amazon Forecast dataset, you must store it in an Amazon S3 bucket.

  • Create an AWS Identity and Access Management (IAM) role. You give Amazon Forecast permission to access your S3 bucket with the IAM role. For more information about IAM roles, see IAM Roles in the IAM User Guide.

To prepare training data
  1. Download the zip file,

    For this exercise, you use a modified version of the individual household electric power consumption dataset. (Dua, D. and Karra Taniskidou, E. (2017). UCI Machine Learning Repository []. Irvine, CA: University of California, School of Information and Computer Science.) We aggregate the usage data hourly.

  2. Unzip the content and save it locally as electricityusagedata.csv.

  3. Upload the data file to an S3 bucket.

    For step-by-step instructions, see Uploading Files and Folders by Using Drag and Drop in the Amazon Simple Storage Service User Guide.

  4. Create an IAM role.

    If you want to use the AWS CLI for the Getting Started exercise, you must create an IAM role. If you use the console, you can have it create the role for you. For step-by-step instructions, see Set Up Permissions for Amazon Forecast.

After you finish uploading the data to Amazon S3, you are ready to use the Amazon Forecast console or the AWS CLI to import training data, create a predictor, generate a forecast, and see the forecast.

Clean Up Resources

To avoid incurring unnecessary charges, delete the resources you created after you're done with the getting started exercise. To delete the resources, use either the Amazon Forecast console or the Delete APIs from the SDKs or the AWS Command Line Interface (AWS CLI). For example, use the DeleteDataset API to delete a dataset.

To delete a resource, its status must be ACTIVE, CREATE_FAILED, or UPDATE_FAILED. Check the status using the Describe APIs, for example, DescribeDataset.

Some resources must be deleted before others, as shown in the following table. This process can take some time.

To delete the training data you uploaded, electricityusagedata.csv, see How Do I Delete Objects from an S3 Bucket?.

Resource to Delete Delete This First Notes
Forecast You can't delete a forecast while it is being exported. After a forecast is deleted, you can no longer query the forecast.
Predictor All associated forecasts.
DatasetImportJob Can not be deleted.

All DatasetImportJobs that target the dataset are also deleted.

You can't delete a Dataset that is used by a predictor.

DatasetSchema All datasets that reference the schema.

All associated predictors

All associated forecasts.

All datasets in the dataset group.

You can't delete a DatasetGroup that contains a Dataset used by a predictor.