AWS Cost Explorer Service
Cost Management APIs

GetReservationCoverage

Retrieves the reservation coverage for your account. This allows you to see how much of your Amazon Elastic Compute Cloud, Amazon ElastiCache, Amazon Relational Database Service, or Amazon Redshift usage is covered by a reservation. An organization's master account can see the coverage of the associated member accounts. For any time period, you can filter data about reservation usage by the following dimensions:

  • AZ

  • CACHE_ENGINE

  • DATABASE_ENGINE

  • DEPLOYMENT_OPTION

  • INSTANCE_TYPE

  • LINKED_ACCOUNT

  • OPERATING_SYSTEM

  • PLATFORM

  • REGION

  • SERVICE

  • TAG

  • TENANCY

To determine valid values for a dimension, use the GetDimensionValues operation.

Request Syntax

{ "Filter": { "And": [ "Expression" ], "Dimensions": { "Key": "string", "Values": [ "string" ] }, "Not": "Expression", "Or": [ "Expression" ], "Tags": { "Key": "string", "Values": [ "string" ] } }, "Granularity": "string", "GroupBy": [ { "Key": "string", "Type": "string" } ], "NextPageToken": "string", "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.

Filter

Filters utilization data by dimensions. You can filter by the following dimensions:

  • AZ

  • CACHE_ENGINE

  • DATABASE_ENGINE

  • DEPLOYMENT_OPTION

  • INSTANCE_TYPE

  • LINKED_ACCOUNT

  • OPERATING_SYSTEM

  • PLATFORM

  • REGION

  • SERVICE

  • TAG

  • TENANCY

GetReservationCoverage uses the same Expression object as the other operations, but only AND is supported among each dimension. You can nest only one level deep. If there are multiple values for a dimension, they are OR'd together.

If you don't provide a SERVICE filter, Cost Explorer defaults to EC2.

Type: Expression object

Required: No

Granularity

The granularity of the AWS cost data for the reservation. Valid values are MONTHLY and DAILY.

If GroupBy is set, Granularity can't be set. If Granularity isn't set, the response object doesn't include Granularity, either MONTHLY or DAILY.

Type: String

Valid Values: DAILY | MONTHLY

Required: No

GroupBy

You can group the data by the following attributes:

  • AZ

  • CACHE_ENGINE

  • DATABASE_ENGINE

  • DEPLOYMENT_OPTION

  • INSTANCE_TYPE

  • LINKED_ACCOUNT

  • OPERATING_SYSTEM

  • PLATFORM

  • REGION

  • TAG

  • TENANCY

Type: Array of GroupDefinition objects

Required: No

NextPageToken

The token to retrieve the next set of results. AWS provides the token when the response from a previous call has more results than the maximum page size.

Type: String

Required: No

TimePeriod

The start and end dates of the period for which you want to retrieve data about reservation coverage. You can retrieve data for a maximum of 13 months: the last 12 months and the current month. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01, then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01.

Type: DateInterval object

Required: Yes

Response Syntax

{ "CoveragesByTime": [ { "Groups": [ { "Attributes": { "string" : "string" }, "Coverage": { "CoverageHours": { "CoverageHoursPercentage": "string", "OnDemandHours": "string", "ReservedHours": "string", "TotalRunningHours": "string" } } } ], "TimePeriod": { "End": "string", "Start": "string" }, "Total": { "CoverageHours": { "CoverageHoursPercentage": "string", "OnDemandHours": "string", "ReservedHours": "string", "TotalRunningHours": "string" } } } ], "NextPageToken": "string", "Total": { "CoverageHours": { "CoverageHoursPercentage": "string", "OnDemandHours": "string", "ReservedHours": "string", "TotalRunningHours": "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.

CoveragesByTime

The amount of time that your reservations covered.

Type: Array of CoverageByTime objects

NextPageToken

The token for the next set of retrievable results. AWS provides the token when the response from a previous call has more results than the maximum page size.

Type: String

Total

The total amount of instance usage that is covered by a reservation.

Type: Coverage object

Errors

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

DataUnavailableException

The requested data is unavailable.

HTTP Status Code: 400

InvalidNextTokenException

The pagination token is invalid. Try again without a pagination token.

HTTP Status Code: 400

LimitExceededException

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

HTTP Status Code: 400

Example

The following example request for the GetReservationCoverage operation retrieves reservation coverage for all t2.nano instance types from 2017-07-01 to 2017-10-01:

Sample Request

POST / HTTP/1.1 Host: ce.us-east-1.amazonaws.com 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.GetReservationCoverage { "TimePeriod": { "Start":"2017-07-01", "End": "2017-10-01" }, "Filter": { "And": [ {"Dimensions": { "Key": "INSTANCE_TYPE", "Values": [ "t2.nano" ] }, {"Dimensions": { "Key": "REGION", "Values": [ "us-east-1" ] }} ] }, "GroupBy":[ { "Type":"Dimension", "Key":"REGION" } ] }

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: <RequestId> Content-Type: application/x-amz-json-1.1 Content-Length: <PayloadSizeBytes> Date: <Date> { "CoveragesByTime": [{ "Groups": [{ "Attributes": { "region": "us-east-1" }, "Coverage": { "CoverageHours": { "CoverageHoursPercentage": "40%", "OnDemandHours": "40", "ReservedHours": "40", "TotalRunningHours": "80" } } }], "TimePeriod": { "End": "2017-07-01", "Start": "2017-10-01" }, "Total": { "CoverageHours": { "CoverageHoursPercentage": "40%", "OnDemandHours": "40", "ReservedHours": "40", "TotalRunningHours": "80" } } }], "Total": { "CoverageHours": { "CoverageHoursPercentage": "40%", "OnDemandHours": "40", "ReservedHours": "40", "TotalRunningHours": "80" } } } }

See Also

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