CreateWhatIfForecastExportCommand

Exports a forecast created by the CreateWhatIfForecast operation to your Amazon Simple Storage Service (Amazon S3) bucket. The forecast file name will match the following conventions:

__

The component is in Java SimpleDateFormat (yyyy-MM-ddTHH-mm-ssZ).

You must specify a DataDestination object that includes an Identity and Access Management (IAM) role that Amazon Forecast can assume to access the Amazon S3 bucket. For more information, see aws-forecast-iam-roles.

For more information, see howitworks-forecast.

To get a list of all your what-if forecast export jobs, use the ListWhatIfForecastExports operation.

The Status of the forecast export job must be ACTIVE before you can access the forecast in your Amazon S3 bucket. To get the status, use the DescribeWhatIfForecastExport operation.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { ForecastClient, CreateWhatIfForecastExportCommand } from "@aws-sdk/client-forecast"; // ES Modules import
// const { ForecastClient, CreateWhatIfForecastExportCommand } = require("@aws-sdk/client-forecast"); // CommonJS import
const client = new ForecastClient(config);
const input = { // CreateWhatIfForecastExportRequest
  WhatIfForecastExportName: "STRING_VALUE", // required
  WhatIfForecastArns: [ // WhatIfForecastArnListForExport // required
    "STRING_VALUE",
  ],
  Destination: { // DataDestination
    S3Config: { // S3Config
      Path: "STRING_VALUE", // required
      RoleArn: "STRING_VALUE", // required
      KMSKeyArn: "STRING_VALUE",
    },
  },
  Tags: [ // Tags
    { // Tag
      Key: "STRING_VALUE", // required
      Value: "STRING_VALUE", // required
    },
  ],
  Format: "STRING_VALUE",
};
const command = new CreateWhatIfForecastExportCommand(input);
const response = await client.send(command);
// { // CreateWhatIfForecastExportResponse
//   WhatIfForecastExportArn: "STRING_VALUE",
// };

CreateWhatIfForecastExportCommand Input

Parameter
Type
Description
Destination
Required
DataDestination | undefined

The location where you want to save the forecast and an Identity and Access Management (IAM) role that Amazon Forecast can assume to access the location. The forecast must be exported to an Amazon S3 bucket.

If encryption is used, Destination must include an Key Management Service (KMS) key. The IAM role must allow Amazon Forecast permission to access the key.

WhatIfForecastArns
Required
string[] | undefined

The list of what-if forecast Amazon Resource Names (ARNs) to export.

WhatIfForecastExportName
Required
string | undefined

The name of the what-if forecast to export.

Format
string | undefined

The format of the exported data, CSV or PARQUET.

Tags
Tag[] | undefined

A list of tags  to apply to the what if forecast.

CreateWhatIfForecastExportCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
WhatIfForecastExportArn
string | undefined

The Amazon Resource Name (ARN) of the what-if forecast.

Throws

Name
Fault
Details
InvalidInputException
client

We can't process the request because it includes an invalid value or a value that exceeds the valid range.

LimitExceededException
client

The limit on the number of resources per account has been exceeded.

ResourceAlreadyExistsException
client

There is already a resource with this name. Try again with a different name.

ResourceInUseException
client

The specified resource is in use.

ResourceNotFoundException
client

We can't find a resource with that Amazon Resource Name (ARN). Check the ARN and try again.

ForecastServiceException
Base exception class for all service exceptions from Forecast service.