GetReservationCoverage - AWS Billing and Cost Management
Services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the AWS European Sovereign Cloud Region, see the AWS European Sovereign Cloud User Guide.

GetReservationCoverage

Retrieves the reservation coverage for your account, which you can use to see how much of your Amazon Elastic Compute Cloud, Amazon Relational Database Service, Amazon ElastiCache, Amazon MemoryDB, Amazon Redshift, Amazon Elasticsearch Service, or Amazon OpenSearch Service usage is covered by a reservation. An organization's management account can see the coverage of the associated member accounts. This supports dimensions, cost categories, and nested expressions. For any time period, you can filter data about reservation usage by the following dimensions:

  • AZ

  • CACHE_ENGINE

  • DATABASE_ENGINE

  • DEPLOYMENT_OPTION

  • INSTANCE_TYPE

  • INSTANCE_TYPE_FAMILY

  • LINKED_ACCOUNT

  • PLATFORM

  • REGION

  • SERVICE

  • TAG

  • TENANCY

The dimensions that you can use depend on the service in the SERVICE filter. For details, see Filter.

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

Request Syntax

{ "Filter": { "And": [ "Expression" ], "CostCategories": { "Key": "string", "MatchOptions": [ "string" ], "Values": [ "string" ] }, "Dimensions": { "Key": "string", "MatchOptions": [ "string" ], "Values": [ "string" ] }, "Not": "Expression", "Or": [ "Expression" ], "ProductAttributes": { "Key": "string", "MatchOptions": [ "string" ], "Values": [ "string" ] }, "Tags": { "Key": "string", "MatchOptions": [ "string" ], "Values": [ "string" ] } }, "Granularity": "string", "GroupBy": [ { "Key": "string", "Type": "string" } ], "MaxResults": number, "Metrics": [ "string" ], "NextPageToken": "string", "SortBy": { "Key": "string", "SortOrder": "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 coverage data by dimensions. You can filter by the following dimensions:

  • AZ

  • CACHE_ENGINE

  • DATABASE_ENGINE

  • DEPLOYMENT_OPTION

  • INSTANCE_TYPE

  • INSTANCE_TYPE_FAMILY

  • LINKED_ACCOUNT

  • PLATFORM

  • REGION

  • SERVICE

    Note

    Supported values for SERVICE are Amazon Elastic Compute Cloud - Compute, Amazon Relational Database Service, Amazon ElastiCache, Amazon MemoryDB, Amazon Redshift, Amazon Elasticsearch Service, and Amazon OpenSearch Service. You can specify up to two SERVICE values.

  • TAG

  • TENANCY

The dimensions that you can use depend on the service in the SERVICE filter. CACHE_ENGINE applies only to Amazon ElastiCache and Amazon MemoryDB. DATABASE_ENGINE and DEPLOYMENT_OPTION apply only to Amazon Relational Database Service. INSTANCE_TYPE_FAMILY, PLATFORM, and TENANCY apply only to Amazon Elastic Compute Cloud - Compute. If you specify two SERVICE values, use only dimensions that both services support.

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.

Cost category is also supported.

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.

The GetReservationCoverage operation supports only DAILY and MONTHLY granularities.

Type: String

Valid Values: DAILY | MONTHLY | HOURLY

Required: No

GroupBy

You can group the data by the following attributes. The attributes that you can use depend on the service in the SERVICE filter. If you don't provide a SERVICE filter, Cost Explorer uses Amazon Elastic Compute Cloud - Compute.

  • Amazon Elastic Compute Cloud - Compute: AZ, INSTANCE_TYPE, INSTANCE_TYPE_FAMILY, LINKED_ACCOUNT, PLATFORM, REGION, and TENANCY

  • Amazon Relational Database Service: AZ, DATABASE_ENGINE, DEPLOYMENT_OPTION, INSTANCE_TYPE, LINKED_ACCOUNT, and REGION

  • Amazon ElastiCache and Amazon MemoryDB: AZ, CACHE_ENGINE, INSTANCE_TYPE, LINKED_ACCOUNT, and REGION

  • Amazon Redshift, Amazon Elasticsearch Service, and Amazon OpenSearch Service: AZ, INSTANCE_TYPE, LINKED_ACCOUNT, and REGION

If you specify two SERVICE values, use only attributes that both services support. You can specify up to four attributes, and only the DIMENSION type is supported.

Type: Array of GroupDefinition objects

Required: No

MaxResults

The maximum number of objects that you returned for this request. If more objects are available, in the response, AWS provides a NextPageToken value that you can use in a subsequent call to get the next batch of objects.

Type: Integer

Valid Range: Minimum value of 1.

Required: No

Metrics

The measurement that you want your reservation coverage reported in.

Valid values are Hour, Unit, and Cost. You can use multiple values in a request. Hour returns CoverageHours, Unit returns CoverageNormalizedUnits, and Cost returns CoverageCost. Unit is supported only for Amazon Elastic Compute Cloud - Compute. If you don't specify Metrics, the response includes only CoverageHours.

Type: Array of strings

Length Constraints: Minimum length of 0. Maximum length of 1024.

Pattern: [\S\s]*

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

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: [\S\s]*

Required: No

SortBy

The value by which you want to sort the data.

The following values are supported for Key:

  • OnDemandCost

  • CoverageHoursPercentage

  • OnDemandHours

  • ReservedHours

  • TotalRunningHours

  • CoverageNormalizedUnitsPercentage

  • OnDemandNormalizedUnits

  • ReservedNormalizedUnits

  • TotalRunningNormalizedUnits

  • Time

Supported values for SortOrder are ASCENDING or DESCENDING.

Type: SortDefinition object

Required: No

TimePeriod

The start and end dates of the period that you want to retrieve data about reservation coverage for. 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": { "CoverageCost": { "OnDemandCost": "string" }, "CoverageHours": { "CoverageHoursPercentage": "string", "OnDemandHours": "string", "ReservedHours": "string", "TotalRunningHours": "string" }, "CoverageNormalizedUnits": { "CoverageNormalizedUnitsPercentage": "string", "OnDemandNormalizedUnits": "string", "ReservedNormalizedUnits": "string", "TotalRunningNormalizedUnits": "string" } } } ], "TimePeriod": { "End": "string", "Start": "string" }, "Total": { "CoverageCost": { "OnDemandCost": "string" }, "CoverageHours": { "CoverageHoursPercentage": "string", "OnDemandHours": "string", "ReservedHours": "string", "TotalRunningHours": "string" }, "CoverageNormalizedUnits": { "CoverageNormalizedUnitsPercentage": "string", "OnDemandNormalizedUnits": "string", "ReservedNormalizedUnits": "string", "TotalRunningNormalizedUnits": "string" } } } ], "NextPageToken": "string", "Total": { "CoverageCost": { "OnDemandCost": "string" }, "CoverageHours": { "CoverageHoursPercentage": "string", "OnDemandHours": "string", "ReservedHours": "string", "TotalRunningHours": "string" }, "CoverageNormalizedUnits": { "CoverageNormalizedUnitsPercentage": "string", "OnDemandNormalizedUnits": "string", "ReservedNormalizedUnits": "string", "TotalRunningNormalizedUnits": "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

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: [\S\s]*

Total

The total amount of instance usage that a reservation covered.

Type: Coverage object

Errors

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

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

Examples

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" ] }} ] }, "Metrics":[ "Hour", "Unit" ], "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" } "CoverageNormalizedUnits": { "CoverageNormalizedUnitsPercentage": "10", "OnDemandNormalizedUnits": "10", "ReservedNormalizedUnits": "10", "TotalRunningNormalizedUnits": "20" } } }], "TimePeriod": { "End": "2017-07-01", "Start": "2017-10-01" }, "Total": { "CoverageHours": { "CoverageHoursPercentage": "40%", "OnDemandHours": "40", "ReservedHours": "40", "TotalRunningHours": "80" } "CoverageNormalizedUnits": { "CoverageNormalizedUnitsPercentage": "10", "OnDemandNormalizedUnits": "10", "ReservedNormalizedUnits": "10", "TotalRunningNormalizedUnits": "20" } } }], "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: