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
SERVICEare 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 twoSERVICEvalues. -
TAG
-
TENANCY
The dimensions that you can use depend on the service in the
SERVICEfilter.CACHE_ENGINEapplies only to Amazon ElastiCache and Amazon MemoryDB.DATABASE_ENGINEandDEPLOYMENT_OPTIONapply only to Amazon Relational Database Service.INSTANCE_TYPE_FAMILY,PLATFORM, andTENANCYapply only to Amazon Elastic Compute Cloud - Compute. If you specify twoSERVICEvalues, use only dimensions that both services support.GetReservationCoverageuses the same Expression object as the other operations, but onlyANDis 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
SERVICEfilter, 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
MONTHLYandDAILY.If
GroupByis set,Granularitycan't be set. IfGranularityisn't set, the response object doesn't includeGranularity, eitherMONTHLYorDAILY.The
GetReservationCoverageoperation supports onlyDAILYandMONTHLYgranularities.Type: String
Valid Values:
DAILY | MONTHLY | HOURLYRequired: No
- GroupBy
-
You can group the data by the following attributes. The attributes that you can use depend on the service in the
SERVICEfilter. If you don't provide aSERVICEfilter, Cost Explorer uses Amazon Elastic Compute Cloud - Compute.-
Amazon Elastic Compute Cloud - Compute:
AZ,INSTANCE_TYPE,INSTANCE_TYPE_FAMILY,LINKED_ACCOUNT,PLATFORM,REGION, andTENANCY -
Amazon Relational Database Service:
AZ,DATABASE_ENGINE,DEPLOYMENT_OPTION,INSTANCE_TYPE,LINKED_ACCOUNT, andREGION -
Amazon ElastiCache and Amazon MemoryDB:
AZ,CACHE_ENGINE,INSTANCE_TYPE,LINKED_ACCOUNT, andREGION -
Amazon Redshift, Amazon Elasticsearch Service, and Amazon OpenSearch Service:
AZ,INSTANCE_TYPE,LINKED_ACCOUNT, andREGION
If you specify two
SERVICEvalues, use only attributes that both services support. You can specify up to four attributes, and only theDIMENSIONtype 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, andCost. You can use multiple values in a request.HourreturnsCoverageHours,UnitreturnsCoverageNormalizedUnits, andCostreturnsCoverageCost.Unitis supported only for Amazon Elastic Compute Cloud - Compute. If you don't specifyMetrics, the response includes onlyCoverageHours.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
SortOrderareASCENDINGorDESCENDING.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
startis2017-01-01andendis2017-05-01, then the cost and usage data is retrieved from2017-01-01up to and including2017-04-30but not including2017-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: