AWS Cost Explorer Service
Cost Management APIs


Retrieves a forecast for how much Amazon Web Services predicts that you will spend over the forecast time period that you select, based on your past costs.

Request Syntax

{ "Filter": { "And": [ "Expression" ], "Dimensions": { "Key": "string", "Values": [ "string" ] }, "Not": "Expression", "Or": [ "Expression" ], "Tags": { "Key": "string", "Values": [ "string" ] } }, "Granularity": "string", "Metric": "string", "PredictionIntervalLevel": number, "TimePeriod": { "End": "string", "Start": "string" } }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.


The filters that you want to use to filter your forecast. Cost Explorer API supports all of the Cost Explorer filters.

Type: Expression object

Required: No


How granular you want the forecast to be. You can get 3 months of DAILY forecasts or 12 months of MONTHLY forecasts.

The GetCostForecast operation supports only DAILY and MONTHLY granularities.

Type: String

Valid Values: DAILY | MONTHLY

Required: Yes


Which metric Cost Explorer uses to create your forecast. For more information about blended and unblended rates, see Why does the "blended" annotation appear on some line items in my bill?.

Valid values for a GetCostForecast call are the following:

  • AmortizedCost

  • BlendedCost

  • NetAmortizedCost

  • NetUnblendedCost

  • UnblendedCost

Type: String


Required: Yes


Cost Explorer always returns the mean forecast as a single point. You can request a prediction interval around the mean by specifying a confidence level. The higher the confidence level, the more confident Cost Explorer is about the actual value falling in the prediction interval. Higher confidence levels result in wider prediction intervals.

Type: Integer

Valid Range: Minimum value of 51. Maximum value of 99.

Required: No


The period of time that you want the forecast to cover.

Type: DateInterval object

Required: Yes

Response Syntax

{ "ForecastResultsByTime": [ { "MeanValue": "string", "PredictionIntervalLowerBound": "string", "PredictionIntervalUpperBound": "string", "TimePeriod": { "End": "string", "Start": "string" } } ], "Total": { "Amount": "string", "Unit": "string" } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.


The forecasts for your query, in order. For DAILY forecasts, this is a list of days. For MONTHLY forecasts, this is a list of months.

Type: Array of ForecastResult objects


How much you are forecasted to spend over the forecast period, in USD.

Type: MetricValue object


For information about the errors that are common to all actions, see Common Errors.


The requested data is unavailable.

HTTP Status Code: 400


You made too many calls in a short period of time. Try again later.

HTTP Status Code: 400


The following example shows how to retrieve a forecast using the GetCostForecast operation.

Sample Request

POST / HTTP/1.1 Host: x-amz-Date: <Date> Authorization: AWS4-HMAC-SHA256 Credential=<Credential>, SignedHeaders=contenttype;date;host;user-agent;x-amz-date;x-amz-target;x-amzn-requestid,Signature=<Signature> User-Agent: <UserAgentString> Content-Type: application/x-amz-json-1.1 Content-Length: <PayloadSizeBytes> Connection: Keep-Alive X-Amz-Target: AWSInsightsIndexService.GetCostForecast { "TimePeriod": { "Start":"2017-10-25", "End": "2017-10-27" }, "Granularity": "MONTHLY", "Filter": { "Dimensions": { "Key": "SERVICE", "Values": [ "Amazon Simple Storage Service" ] } }, "Metrics":"BlendedCost", "PredictionIntervalLevel":85 }

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: <RequestId> Content-Type: application/x-amz-json-1.1 Content-Length: <PayloadSizeBytes> Date: <Date> { "ForecastResultsByTime": [ { "MeanValue": "37.0786663399", "PredictionIntervalLowerBound": "34.9970026341", "PredictionIntervalUpperBound": "39.1603300457", "TimePeriod": { "End": "2018-10-26", "Start": "2018-10-25" } }, { "MeanValue": "37.0786663399", "PredictionIntervalLowerBound": "34.9970026341", "PredictionIntervalUpperBound": "39.1603300457", "TimePeriod": { "End": "2018-10-27", "Start": "2018-10-26" } } ], "Total": { "Amount": "74.1573326798", "Unit": "USD" } }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: